Repository: atlas
Updated Branches:
  refs/heads/master eb5d6fcdc -> 38297a844


ATLAS-1997: fix to avoid NPE while getting vertex_indices

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


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

Branch: refs/heads/master
Commit: 38297a8441e7d32d41e717fd6efc415804e640af
Parents: eb5d6fc
Author: apoorvnaik <apoorvn...@apache.org>
Authored: Thu Jul 27 09:51:23 2017 -0700
Committer: Madhan Neethiraj <mad...@apache.org>
Committed: Wed Aug 2 18:14:52 2017 -0700

----------------------------------------------------------------------
 .../repository/graph/GraphBackedSearchIndexer.java  | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/38297a84/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
----------------------------------------------------------------------
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
 
b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
index 94b6092..632b479 100755
--- 
a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
@@ -263,17 +263,19 @@ public class GraphBackedSearchIndexer implements 
SearchIndexer, ActiveStateChang
             }
 
             if (management != null) {
-                recomputeIndexedKeys = false;
-
                 AtlasGraphIndex vertexIndex = 
management.getGraphIndex(Constants.VERTEX_INDEX);
 
-                Set<String> indexKeys = new HashSet<>();
+                if (vertexIndex != null) {
+                    recomputeIndexedKeys = false;
 
-                for (AtlasPropertyKey fieldKey : vertexIndex.getFieldKeys()) {
-                    indexKeys.add(fieldKey.getName());
-                }
+                    Set<String> indexKeys = new HashSet<>();
 
-                vertexIndexKeys = indexKeys;
+                    for (AtlasPropertyKey fieldKey : 
vertexIndex.getFieldKeys()) {
+                        indexKeys.add(fieldKey.getName());
+                    }
+
+                    vertexIndexKeys = indexKeys;
+                }
             }
         }
 

Reply via email to