ATLAS-3201:- Fix getByGuid in AtlasTypeRegistry, doesn't raise exception if guid invalid
Signed-off-by: nixonrodrigues <nixon@apache.org>
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
index f9aa4a9..c0ac7ad 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -116,12 +116,14 @@
return ret;
}
- public AtlasType getTypeByGuid(String guid) {
+ public AtlasType getTypeByGuid(String guid) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasTypeRegistry.getTypeByGuid({})", guid);
}
AtlasType ret = registryData.allTypes.getTypeByGuid(guid);
+ if(ret == null)
+ throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid);
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasTypeRegistry.getTypeByGuid({}): {}", guid, ret);