mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-04 07:08:09 +00:00
This commit is contained in:
parent
369b8c3b31
commit
170cb529ea
@ -257,6 +257,11 @@ public final class ChangeEventParser {
|
||||
}
|
||||
|
||||
private static String getUpdateMessage(String updatedField, Object oldValue, Object newValue) {
|
||||
// New value should not be null in any case for an update
|
||||
if (newValue == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
if (oldValue == null || oldValue.toString().isEmpty()) {
|
||||
return String.format("Updated **%s** to %s", updatedField, getFieldValue(newValue));
|
||||
} else if (updatedField.contains("tags") || updatedField.contains("owner")) {
|
||||
@ -265,6 +270,7 @@ public final class ChangeEventParser {
|
||||
// if old value is not empty, and is of type array or object, the updates can be across multiple keys
|
||||
// Example: [{name: "col1", dataType: "varchar", dataLength: "20"}]
|
||||
|
||||
if (!newValue.toString().isEmpty()) {
|
||||
try {
|
||||
// Check if field value is a json string
|
||||
JsonValue newJson = JsonUtils.readJson(newValue.toString());
|
||||
@ -292,10 +298,11 @@ public final class ChangeEventParser {
|
||||
return getObjectUpdateMessage(updatedField, oldJsonObject, newJsonObject);
|
||||
}
|
||||
} catch (JsonParsingException ex) {
|
||||
// update is of String type
|
||||
return getPlainTextUpdateMessage(updatedField, oldValue.toString(), newValue.toString());
|
||||
// update is of type String
|
||||
// ignore this exception and process update message for plain text
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return getPlainTextUpdateMessage(updatedField, oldValue.toString(), newValue.toString());
|
||||
}
|
||||
|
||||
private static String getPlaintextDiff(String oldValue, String newValue) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user