ATLAS-2251: fixed NPE in V1 to V2 entity conversion

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

Branch: refs/heads/master
Commit: 6a1c4f4df2b906673a8cedd6abbd20761fcfb183
Parents: 41e5404
Author: Madhan Neethiraj <mad...@apache.org>
Authored: Sun Nov 12 14:39:13 2017 -0800
Committer: Madhan Neethiraj <mad...@apache.org>
Committed: Sun Nov 12 14:39:13 2017 -0800

----------------------------------------------------------------------
 .../converters/AtlasEntityFormatConverter.java          | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/6a1c4f4d/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java
----------------------------------------------------------------------
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java
 
b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java
index a529dc1..2229ece 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java
@@ -66,10 +66,14 @@ public class AtlasEntityFormatConverter extends 
AtlasStructFormatConverter {
 
                     entity.setGuid(entRef.getId().getId());
                     entity.setStatus(convertState(entRef.getId().getState()));
-                    
entity.setCreatedBy(entRef.getSystemAttributes().getCreatedBy());
-                    
entity.setCreateTime(entRef.getSystemAttributes().getCreatedTime());
-                    
entity.setUpdatedBy(entRef.getSystemAttributes().getModifiedBy());
-                    
entity.setUpdateTime(entRef.getSystemAttributes().getModifiedTime());
+
+                    if (entRef.getSystemAttributes() != null) {
+                        
entity.setCreatedBy(entRef.getSystemAttributes().getCreatedBy());
+                        
entity.setCreateTime(entRef.getSystemAttributes().getCreatedTime());
+                        
entity.setUpdatedBy(entRef.getSystemAttributes().getModifiedBy());
+                        
entity.setUpdateTime(entRef.getSystemAttributes().getModifiedTime());
+                    }
+
                     entity.setVersion((long) entRef.getId().getVersion());
 
                     if (CollectionUtils.isNotEmpty(entRef.getTraitNames())) {

Reply via email to