Repository: incubator-atlas
Updated Branches:
  refs/heads/master 86740c148 -> b688f80e9


ATLAS-1322: fix dereference null return value

Signed-off-by: Madhan Neethiraj <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/b688f80e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/b688f80e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/b688f80e

Branch: refs/heads/master
Commit: b688f80e9072d6c7c9bc46d441b8ce87318bcdd5
Parents: 86740c1
Author: Sarath Subramanian <[email protected]>
Authored: Wed Nov 23 10:14:01 2016 -0800
Committer: Madhan Neethiraj <[email protected]>
Committed: Sat Nov 26 00:37:37 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/atlas/util/RestUtils.java   | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b688f80e/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/util/RestUtils.java 
b/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
index bc937e4..7597dcb 100644
--- a/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
+++ b/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
@@ -320,17 +320,19 @@ public final class RestUtils {
                                         if (isForeignKey) {
                                             AtlasType attribType = 
entityType.getAttributeType(attrDef.getName());
 
-                                            if (attribType.getTypeCategory() 
== TypeCategory.ARRAY) {
-                                                attribType = ((AtlasArrayType) 
attribType).getElementType();
-                                            }
+                                            if (attribType != null) {
+                                                if 
(attribType.getTypeCategory() == TypeCategory.ARRAY) {
+                                                    attribType = 
((AtlasArrayType) attribType).getElementType();
+                                                }
 
-                                            if (attribType.getTypeCategory() 
== TypeCategory.ENTITY) {
-                                                String revAttrName = 
((AtlasEntityType) attribType).
-                                                        
getMappedFromRefAttribute(entityType.getTypeName(), attrDef.getName());
+                                                if 
(attribType.getTypeCategory() == TypeCategory.ENTITY) {
+                                                    String revAttrName = 
((AtlasEntityType) attribType).
+                                                            
getMappedFromRefAttribute(entityType.getTypeName(), attrDef.getName());
 
-                                                if 
(StringUtils.equals(classTypeDefName , attrDef.getTypeName()) &&
-                                                        
StringUtils.equals(oldAttr.name, revAttrName)) {
-                                                    refAttrName = 
attrDef.getName();
+                                                    if 
(StringUtils.equals(classTypeDefName, attrDef.getTypeName()) &&
+                                                            
StringUtils.equals(oldAttr.name, revAttrName)) {
+                                                        refAttrName = 
attrDef.getName();
+                                                    }
                                                 }
                                             }
                                         }

Reply via email to