You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by "Srikanth Venkat (Jira)" <ji...@apache.org> on 2022/07/29 18:50:00 UTC
[jira] [Created] (ATLAS-4652) Missing null check leading to NPE in isSoftReferenced method in AtlasStructDef
Srikanth Venkat created ATLAS-4652:
--------------------------------------
Summary: Missing null check leading to NPE in isSoftReferenced method in AtlasStructDef
Key: ATLAS-4652
URL: https://issues.apache.org/jira/browse/ATLAS-4652
Project: Atlas
Issue Type: Bug
Components: atlas-core
Affects Versions: 2.2.0
Reporter: Srikanth Venkat
The code inside isSoftReferenced method in AtlasStructDef class below:
*{{}}* {{@JsonIgnore}}
{{ public boolean isSoftReferenced() {}}
{{ return this.options != null && }}{{ getOptions().containsKey(AtlasAttributeDef.ATTRDEF_OPTION_SOFT_REFERENCE) &&}}
{{ getOptions().get(AtlasAttributeDef.ATTRDEF_OPTION_SOFT_REFERENCE){color:#de350b}.equals(STRING_TRUE){color};}}
{{ }}}
Since the null check is not performed, it can lead to NPE in typedef resolution.
A sample typedef payload like the following can potentially trigger the NPE error in attribute resolution, i.e. EntityGraphRetriever.mapVertexToAttribute, where attribute.getAttributeDef().isSoftReferenced() is called
{
"businessMetadataDefs": [
{
"category": "BUSINESS_METADATA",
"name": "bizType1",
"description": "test",
"attributeDefs": [
{
"name": "bizAttr1",
"typeName": "string",
"isOptional": true,
"cardinality": "SINGLE",
"options": {
*"isSoftReference": null,*
"maxStrLength": "50",
"applicableEntityTypes": "[\"Asset\"]"
}
}
]
}
]
}
It would be furthermore helpful to run SonarCube or FindBugs to determine any other incidences where this pattern of missing null check exists in Atlas codebase and address them.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)