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 2017/09/17 22:42:42 UTC

[3/3] atlas git commit: ATLAS-2141: edit/disassociate tag results in NPE

ATLAS-2141: edit/disassociate tag results in NPE

(cherry picked from commit 4b9d2670709df52e0d983587832fe6256220691b)


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

Branch: refs/heads/master
Commit: c1f4007a9d9f85f888a5c9164e11937025157edb
Parents: ccd121e
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Sun Sep 17 10:37:26 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Sun Sep 17 14:51:49 2017 -0700

----------------------------------------------------------------------
 .../org/apache/atlas/repository/graph/GraphHelper.java |  6 +++++-
 .../store/graph/v1/AtlasEntityChangeNotifier.java      | 13 ++-----------
 .../notification/NotificationEntityChangeListener.java |  4 +++-
 3 files changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/c1f4007a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
index 4cb430d..639077d 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
@@ -1079,8 +1079,12 @@ public final class GraphHelper {
 
     }
 
+    public static boolean isInternalType(AtlasVertex vertex) {
+        return vertex != null && isInternalType(getTypeName(vertex));
+    }
+
     public static boolean isInternalType(String typeName) {
-        return typeName.startsWith(Constants.INTERNAL_PROPERTY_KEY_PREFIX);
+        return typeName != null && typeName.startsWith(Constants.INTERNAL_PROPERTY_KEY_PREFIX);
     }
 
     public static void setArrayElementsProperty(IDataType elementType, AtlasVertex instanceVertex, String propertyName, List<Object> values) {

http://git-wip-us.apache.org/repos/asf/atlas/blob/c1f4007a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
index db47627..7b349c4 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
@@ -227,14 +227,10 @@ public class AtlasEntityChangeNotifier {
         }
 
         for (AtlasEntityHeader atlasEntityHeader : atlasEntityHeaders) {
-            if(GraphHelper.isInternalType(atlasEntityHeader.getTypeName())) {
-                continue;
-            }
-
             String      guid        = atlasEntityHeader.getGuid();
             AtlasVertex atlasVertex = AtlasGraphUtilsV1.findByGuid(guid);
 
-            if(atlasVertex == null) {
+            if(atlasVertex == null || GraphHelper.isInternalType(atlasVertex)) {
                 continue;
             }
 
@@ -262,12 +258,7 @@ public class AtlasEntityChangeNotifier {
         }
 
         AtlasVertex atlasVertex = AtlasGraphUtilsV1.findByGuid(entityId);
-        if(atlasVertex == null) {
-            return;
-        }
-
-        if (atlasVertex == null) {
-            LOG.warn("updateFullTextMapping(): no entity exists with guid {}", entityId);
+        if(atlasVertex == null || GraphHelper.isInternalType(atlasVertex)) {
             return;
         }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/c1f4007a/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java b/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
index 604a19e..53acf56 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/NotificationEntityChangeListener.java
@@ -187,7 +187,9 @@ public class NotificationEntityChangeListener implements EntityChangeListener {
             messages.add(notification);
         }
 
-        notificationInterface.send(NotificationInterface.NotificationType.ENTITIES, messages);
+        if (!messages.isEmpty()) {
+            notificationInterface.send(NotificationInterface.NotificationType.ENTITIES, messages);
+        }
     }
 
     private List<String> getNotificationAttributes(String entityType) {