This is an automated email from the ASF dual-hosted git repository.

nixon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new a0474d1  ATLAS-3988 : Fix NPE in entity REST API when passed with 
type's GUID.
a0474d1 is described below

commit a0474d142c702e75f1820bffa542dc8cf39ba79d
Author: chaitali borole <[email protected]>
AuthorDate: Wed Oct 21 12:18:48 2020 +0530

    ATLAS-3988 : Fix NPE in entity REST API when passed with type's GUID.
    
    Signed-off-by: nixonrodrigues <[email protected]>
---
 intg/src/main/java/org/apache/atlas/AtlasErrorCode.java               | 2 +-
 .../apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java 
b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index a14e43a..ad67fa9 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -170,7 +170,6 @@ public enum AtlasErrorCode {
     INVALID_FILE_TYPE(400, "ATLAS-400-00-098", "The provided file type {0} is 
not supported."),
     INVALID_BUSINESS_ATTRIBUTES_IMPORT_DATA(400, "ATLAS-400-00-099","The 
uploaded file was not processed due to following errors : {0}"),
     ATTRIBUTE_NAME_INVALID_CHARS(400, "ATLAS-400-00-09A", "{0}: invalid name. 
Attribute names must begin with a letter followed by a sequence of letters, 
numbers, or '_' characters"),
-
     UNAUTHORIZED_ACCESS(403, "ATLAS-403-00-001", "{0} is not authorized to 
perform {1}"),
 
     // All Not found enums go here
@@ -195,6 +194,7 @@ public enum AtlasErrorCode {
     NO_PROPAGATED_CLASSIFICATIONS_FOUND_FOR_ENTITY(404, "ATLAS-404-00-013", 
"No propagated classifications associated with entity: {0}"),
     NO_DATA_FOUND(404, "ATLAS-404-00-014", "No data found in the uploaded 
file"),
     FILE_NAME_NOT_FOUND(404, "ATLAS-404-00-015", "File name should not be 
blank"),
+    NO_TYPE_NAME_ON_VERTEX(404, "ATLAS-404-00-016", "No typename found for 
given entity with guid: {0}"),
 
     // All data conflict errors go here
     TYPE_ALREADY_EXISTS(409, "ATLAS-409-00-001", "Given type {0} already 
exists"),
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
index 2199277..8208d11 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
@@ -379,6 +379,10 @@ public class EntityGraphRetriever {
             throw new 
AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
 
+        if (StringUtils.isEmpty(GraphHelper.getTypeName(ret))) {
+            throw new 
AtlasBaseException(AtlasErrorCode.NO_TYPE_NAME_ON_VERTEX, guid);
+        }
+
         return ret;
     }
 

Reply via email to