mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
Add Check for Null destinations (#20717)
This commit is contained in:
parent
7c5ba41630
commit
4aa070f04e
@ -57,15 +57,17 @@ public class MigrationUtil {
|
||||
JSONObject jsonObj = new JSONObject(eventSubscription);
|
||||
// Read array detination if exist and check subscription type if Generic then change to
|
||||
// Webhook
|
||||
JSONArray destination = jsonObj.getJSONArray("destinations");
|
||||
if (destination != null && !destination.isEmpty()) {
|
||||
for (Object value : destination) {
|
||||
JSONObject destinationObj = (JSONObject) value;
|
||||
if (destinationObj.getString("type").equals("Generic")) {
|
||||
destinationObj.put("type", "Webhook");
|
||||
collectionDAO
|
||||
.eventSubscriptionDAO()
|
||||
.update(JsonUtils.readValue(jsonObj.toString(), EventSubscription.class));
|
||||
if (jsonObj.keySet().contains("destinations")) {
|
||||
JSONArray destination = jsonObj.getJSONArray("destinations");
|
||||
if (destination != null && !destination.isEmpty()) {
|
||||
for (Object value : destination) {
|
||||
JSONObject destinationObj = (JSONObject) value;
|
||||
if (destinationObj.getString("type").equals("Generic")) {
|
||||
destinationObj.put("type", "Webhook");
|
||||
collectionDAO
|
||||
.eventSubscriptionDAO()
|
||||
.update(JsonUtils.readValue(jsonObj.toString(), EventSubscription.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user