You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ni...@apache.org on 2020/03/03 11:55:56 UTC
[atlas] 01/02: ATLAS-3358 NPE when Atlas is trying to read from
graphDB
This is an automated email from the ASF dual-hosted git repository.
nixon pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 4099b072c70f1480f7c4f1f494b2b400dea7df59
Author: nikhilbonte <ni...@freestoneinfotech.com>
AuthorDate: Mon Aug 5 12:20:17 2019 +0530
ATLAS-3358 NPE when Atlas is trying to read from graphDB
Change-Id: Ie9037cafc3e72679d2700c620f0d0d63954d6ddd
---
.../repository/typestore/GraphBackedTypeStore.java | 50 ++++++++++++----------
1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
index ba71c1e..3eaa5d0 100644
--- a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
@@ -255,34 +255,38 @@ public class GraphBackedTypeStore implements ITypeStore {
String typeName = AtlasGraphUtilsV1.getEncodedProperty(vertex, Constants.TYPENAME_PROPERTY_KEY, String.class);
String typeDescription = AtlasGraphUtilsV1.getEncodedProperty(vertex, Constants.TYPEDESCRIPTION_PROPERTY_KEY, String.class);
LOG.info("Restoring type {}.{}.{}", typeCategory, typeName, typeDescription);
- switch (typeCategory) {
- case ENUM:
- enums.add(getEnumType(vertex));
- break;
- case STRUCT:
- AttributeDefinition[] attributes = getAttributes(vertex, typeName);
- structs.add(new StructTypeDefinition(typeName, typeDescription, attributes));
- break;
+ if(typeCategory != null && typeName != null ) {
- case CLASS:
- ImmutableSet<String> superTypes = getSuperTypes(vertex);
- attributes = getAttributes(vertex, typeName);
- classTypes.add(new HierarchicalTypeDefinition(ClassType.class, typeName, typeDescription, superTypes, attributes));
- break;
+ switch (typeCategory) {
+ case ENUM:
+ enums.add(getEnumType(vertex));
+ break;
- case TRAIT:
- superTypes = getSuperTypes(vertex);
- attributes = getAttributes(vertex, typeName);
- traits.add(new HierarchicalTypeDefinition(TraitType.class, typeName, typeDescription, superTypes, attributes));
- break;
+ case STRUCT:
+ AttributeDefinition[] attributes = getAttributes(vertex, typeName);
+ structs.add(new StructTypeDefinition(typeName, typeDescription, attributes));
+ break;
- case RELATIONSHIP:
- // v1 typesystem is not notified on new relation type
- break;
+ case CLASS:
+ ImmutableSet<String> superTypes = getSuperTypes(vertex);
+ attributes = getAttributes(vertex, typeName);
+ classTypes.add(new HierarchicalTypeDefinition(ClassType.class, typeName, typeDescription, superTypes, attributes));
+ break;
- default:
- throw new IllegalArgumentException("Unhandled type category " + typeCategory);
+ case TRAIT:
+ superTypes = getSuperTypes(vertex);
+ attributes = getAttributes(vertex, typeName);
+ traits.add(new HierarchicalTypeDefinition(TraitType.class, typeName, typeDescription, superTypes, attributes));
+ break;
+
+ case RELATIONSHIP:
+ // v1 typesystem is not notified on new relation type
+ break;
+
+ default:
+ throw new IllegalArgumentException("Unhandled type category " + typeCategory);
+ }
}
}
return TypesUtil.getTypesDef(enums.build(), structs.build(), traits.build(), classTypes.build());