Commit c3318467 by Madhan Neethiraj

ATLAS-1415: fix potential NPE issues found by Coverity scan

parent 0e7ef3af
...@@ -126,6 +126,12 @@ public class AtlasStructFormatConverter extends AtlasAbstractFormatConverter { ...@@ -126,6 +126,12 @@ public class AtlasStructFormatConverter extends AtlasAbstractFormatConverter {
for (AtlasStructDef.AtlasAttributeDef attrDef : getAttributeDefs(structType)) { for (AtlasStructDef.AtlasAttributeDef attrDef : getAttributeDefs(structType)) {
AtlasType attrType = structType.getAttributeType(attrDef.getName()); AtlasType attrType = structType.getAttributeType(attrDef.getName());
if (attrType == null) {
LOG.warn("ignored attribute {}.{}: failed to find AtlasType", structType.getTypeName(), attrDef.getName());
continue;
}
AtlasFormatConverter attrConverter = converterRegistry.getConverter(attrType.getTypeCategory()); AtlasFormatConverter attrConverter = converterRegistry.getConverter(attrType.getTypeCategory());
Object v2Value = attributes.get(attrDef.getName()); Object v2Value = attributes.get(attrDef.getName());
......
...@@ -174,9 +174,13 @@ public class EntitiesREST { ...@@ -174,9 +174,13 @@ public class EntitiesREST {
AtlasEntity.AtlasEntities atlasEntities = entitiesStore.searchEntities(searchFilter); AtlasEntity.AtlasEntities atlasEntities = entitiesStore.searchEntities(searchFilter);
AtlasEntityHeader.AtlasEntityHeaders entityHeaders = new AtlasEntityHeader.AtlasEntityHeaders(); AtlasEntityHeader.AtlasEntityHeaders entityHeaders = new AtlasEntityHeader.AtlasEntityHeaders();
entityHeaders.setList(new LinkedList<AtlasEntityHeader>()); entityHeaders.setList(new LinkedList<AtlasEntityHeader>());
if (atlasEntities != null) {
for (AtlasEntity atlasEntity : atlasEntities.getList()) { for (AtlasEntity atlasEntity : atlasEntities.getList()) {
entityHeaders.getList().add(new AtlasEntityHeader(atlasEntity.getTypeName(), atlasEntity.getAttributes())); entityHeaders.getList().add(new AtlasEntityHeader(atlasEntity.getTypeName(), atlasEntity.getAttributes()));
} }
}
return entityHeaders; return entityHeaders;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment