You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2016/11/26 08:37:48 UTC

incubator-atlas git commit: ATLAS-1322: fix dereference null return value

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


ATLAS-1322: fix dereference null return value

Signed-off-by: Madhan Neethiraj <ma...@apache.org>


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 <ss...@hortonworks.com>
Authored: Wed Nov 23 10:14:01 2016 -0800
Committer: Madhan Neethiraj <ma...@apache.org>
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();
+                                                    }
                                                 }
                                             }
                                         }