atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1285: fix for issues flagged by Coverity scan
Date Fri, 11 Nov 2016 00:01:59 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 71714d20f -> 2119666fd


ATLAS-1285: fix for issues flagged by Coverity scan


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

Branch: refs/heads/master
Commit: 2119666fd0d224c8d6f0d9c139ad11749e58bf73
Parents: 71714d2
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Thu Nov 10 14:23:27 2016 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Thu Nov 10 14:50:31 2016 -0800

----------------------------------------------------------------------
 .../store/bootstrap/AtlasTypeDefStoreInitializer.java         | 7 +++----
 .../org/apache/atlas/web/resources/TypesJerseyResourceIT.java | 7 +++++--
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/2119666f/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
index e52ac6d..036a548 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
@@ -315,14 +315,13 @@ public class AtlasTypeDefStoreInitializer {
 
         @Override
         public void applyPatch(TypeDefPatch patch) throws AtlasBaseException {
-            String typeName = patch.getTypeName();
+            String           typeName = patch.getTypeName();
+            AtlasBaseTypeDef typeDef  = typeRegistry.getTypeDefByName(typeName);
 
-            if (!typeRegistry.isRegisteredType(typeName)) {
+            if (typeDef == null) {
                 throw new AtlasBaseException(AtlasErrorCode.PATCH_FOR_UNKNOWN_TYPE, patch.getAction(),
typeName);
             }
 
-            AtlasBaseTypeDef typeDef = typeRegistry.getTypeDefByName(typeName);
-
             if (isPatchApplicable(patch, typeDef)) {
                 if (typeDef.getClass().equals(AtlasEntityDef.class)) {
                     AtlasEntityDef updatedDef = new AtlasEntityDef((AtlasEntityDef)typeDef);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/2119666f/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
index 43584f9..7a19091 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
@@ -52,6 +52,7 @@ import java.util.List;
 
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.fail;
 
 /**
@@ -134,8 +135,10 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
         assertEquals(typesUpdated.size(), 1);
         Assert.assertTrue(typesUpdated.contains(typeDefinition.typeName));
 
-        HierarchicalTypeDefinition<ClassType>
-                updatedType = serviceClient.getType(typeDefinition.typeName).classTypesAsJavaList().get(0);
+        TypesDef updatedTypeDef = serviceClient.getType(typeDefinition.typeName);
+        assertNotNull(updatedTypeDef);
+
+        HierarchicalTypeDefinition<ClassType> updatedType = updatedTypeDef.classTypesAsJavaList().get(0);
         assertEquals(updatedType.attributeDefinitions.length, 2);
     }
 


Mime
View raw message