You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sh...@apache.org on 2016/10/02 13:35:25 UTC

[5/5] incubator-atlas git commit: ATLAS-1203 'Invalid type definition' due to no new types to be created at startup (mneethiraj via shwethags)

ATLAS-1203 'Invalid type definition' due to no new types to be created at startup (mneethiraj via shwethags)


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

Branch: refs/heads/master
Commit: 2a441bec1f4d0ae2621e4b878f4738c032392e0a
Parents: 698a565
Author: Shwetha GS <ss...@hortonworks.com>
Authored: Sun Oct 2 18:25:30 2016 +0530
Committer: Shwetha GS <ss...@hortonworks.com>
Committed: Sun Oct 2 18:25:30 2016 +0530

----------------------------------------------------------------------
 release-log.txt                                      |  1 +
 .../atlas/services/ReservedTypesRegistrar.java       | 15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/2a441bec/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 85ceaa4..0f22801 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
 ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
 
 ALL CHANGES:
+ATLAS-1203 'Invalid type definition' due to no new types to be created at startup (mneethiraj via shwethags)
 ATLAS-1171 Structured, high-level public APIs (mneethiraj via shwethags)
 ATLAS-247 Hive Column level lineage (rhbutani,svimal2106 via shwethags)
 ATLAS-1184 ReservedTypesRegistrar checks for existence of 1st class type (svimal2106 via shwethags)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/2a441bec/repository/src/main/java/org/apache/atlas/services/ReservedTypesRegistrar.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/services/ReservedTypesRegistrar.java b/repository/src/main/java/org/apache/atlas/services/ReservedTypesRegistrar.java
index 6e0b586..c269c3a 100644
--- a/repository/src/main/java/org/apache/atlas/services/ReservedTypesRegistrar.java
+++ b/repository/src/main/java/org/apache/atlas/services/ReservedTypesRegistrar.java
@@ -68,7 +68,10 @@ public class ReservedTypesRegistrar implements IBootstrapTypesRegistrar {
                 String typeDefJSON = new String(Files.readAllBytes(typeDefFile.toPath()), StandardCharsets.UTF_8);
                 registerType(typeSystem, metadataService, typeDefFile.getAbsolutePath(), typeDefJSON);
             } catch (IOException e) {
-                e.printStackTrace();
+                LOG.error("error while registering types in file " + typeDefFile.getAbsolutePath(), e);
+            } catch (AtlasException e) {
+                LOG.error("error while registering types in file " + typeDefFile.getAbsolutePath(), e);
+                throw e;
             }
         }
 
@@ -119,10 +122,12 @@ public class ReservedTypesRegistrar implements IBootstrapTypesRegistrar {
         TypesDef createTypes = TypesUtil.getTypesDef(ImmutableList.copyOf(createEnumDefList), ImmutableList.copyOf(createStructDefList),
                 ImmutableList.copyOf(createTraitDefList), ImmutableList.copyOf(createClassDefList));
 
-        String createTypeJSON = TypesSerialization.toJson(createTypes);
-        if(createTypeJSON != null) {
-            metadataService.createType(createTypeJSON);
-            LOG.info("Created types definition JSON {}", createTypeJSON);
+        if (! createTypes.isEmpty()) {
+            String createTypeJSON = TypesSerialization.toJson(createTypes);
+            if (createTypeJSON != null) {
+                metadataService.createType(createTypeJSON);
+                LOG.info("Created types definition JSON {}", createTypeJSON);
+            }
         }
     }
 }