Skip to content

Commit

Permalink
Merge pull request #4070 from atlanhq/MLH-44
Browse files Browse the repository at this point in the history
MLH-44 Fix fetching relationship attributes NPE for corrupt vertex
  • Loading branch information
nikhilbonte21 authored Feb 3, 2025
2 parents 777aa9a + 45b3de7 commit ae810f5
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1887,15 +1887,23 @@ private AtlasObjectId mapVertexToObjectId(AtlasVertex entityVertex, String edgeL
} else {
ret = toAtlasObjectId(referenceVertex);
}

if (ret == null) {
LOG.warn("Found corrupted vertex with Id: {}", referenceVertex.getIdForDisplay());
}
}

if (RequestContext.get().isIncludeRelationshipAttributes()) {
if (ret != null && RequestContext.get().isIncludeRelationshipAttributes()) {
String relationshipTypeName = GraphHelper.getTypeName(edge);
boolean isRelationshipAttribute = typeRegistry.getRelationshipDefByName(relationshipTypeName) != null;
if (isRelationshipAttribute) {
AtlasRelationship relationship = mapEdgeToAtlasRelationship(edge);
Map<String, Object> relationshipAttributes = mapOf("typeName", relationshipTypeName);
relationshipAttributes.put("attributes", relationship.getAttributes());

if (ret.getAttributes() == null) {
ret.setAttributes(new HashMap<>());
}
ret.getAttributes().put("relationshipAttributes", relationshipAttributes);
}
}
Expand Down

0 comments on commit ae810f5

Please sign in to comment.