Skip to content

Commit de15040

Browse files
authored
Merge pull request #1199 from atlanhq/FT-900
Fix null-handling for embedded audit details
2 parents 3ebd831 + 5cdcaa3 commit de15040

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

sdk/src/main/java/com/atlan/serde/EntityAuditDeserializer.java

+17-14
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,23 @@ public EntityAudit deserialize(JsonParser parser, DeserializationContext context
6464
.headers(JacksonUtils.deserializeObject(client, root, "headers", new TypeReference<>() {}));
6565

6666
JsonNode detail = root.get("detail");
67-
JsonNode guid = detail.get("guid"); // only exists on entities
68-
JsonNode attributes = detail.get("attributes"); // exists on entities and custom metadata
69-
AuditDetail auditDetail;
70-
if (guid != null && guid.isTextual()) {
71-
// Delegate to entity deserialization
72-
auditDetail = client.getAssetDeserializer().deserialize(detail, ts);
73-
} else if (attributes != null) {
74-
// Delegate to the custom metadata deserialization
75-
auditDetail = client.getCustomMetadataAuditDeserializer().deserialize(detail, ts);
76-
} else {
77-
// Delegate to Atlan tag deserialization
78-
auditDetail = client.getAtlanTagDeserializer().deserialize(detail, ts);
67+
if (detail != null && !detail.isNull()) {
68+
JsonNode guid = detail.get("guid"); // only exists on entities
69+
JsonNode attributes = detail.get("attributes"); // exists on entities and custom metadata
70+
AuditDetail auditDetail;
71+
if (guid != null && guid.isTextual()) {
72+
// Delegate to entity deserialization
73+
auditDetail = client.getAssetDeserializer().deserialize(detail, ts);
74+
} else if (attributes != null) {
75+
// Delegate to the custom metadata deserialization
76+
auditDetail = client.getCustomMetadataAuditDeserializer().deserialize(detail, ts);
77+
} else {
78+
// Delegate to Atlan tag deserialization
79+
auditDetail = client.getAtlanTagDeserializer().deserialize(detail, ts);
80+
}
81+
auditDetail.setRawJsonObject(detail);
82+
builder.detail(auditDetail);
7983
}
80-
auditDetail.setRawJsonObject(detail);
81-
return builder.detail(auditDetail).build();
84+
return builder.build();
8285
}
8386
}

0 commit comments

Comments
 (0)