File tree Expand file tree Collapse file tree
openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v140 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,15 +57,17 @@ public static void migrateGenericToWebhook(CollectionDAO collectionDAO) {
5757 JSONObject jsonObj = new JSONObject (eventSubscription );
5858 // Read array detination if exist and check subscription type if Generic then change to
5959 // Webhook
60- JSONArray destination = jsonObj .getJSONArray ("destinations" );
61- if (destination != null && !destination .isEmpty ()) {
62- for (Object value : destination ) {
63- JSONObject destinationObj = (JSONObject ) value ;
64- if (destinationObj .getString ("type" ).equals ("Generic" )) {
65- destinationObj .put ("type" , "Webhook" );
66- collectionDAO
67- .eventSubscriptionDAO ()
68- .update (JsonUtils .readValue (jsonObj .toString (), EventSubscription .class ));
60+ if (jsonObj .keySet ().contains ("destinations" )) {
61+ JSONArray destination = jsonObj .getJSONArray ("destinations" );
62+ if (destination != null && !destination .isEmpty ()) {
63+ for (Object value : destination ) {
64+ JSONObject destinationObj = (JSONObject ) value ;
65+ if (destinationObj .getString ("type" ).equals ("Generic" )) {
66+ destinationObj .put ("type" , "Webhook" );
67+ collectionDAO
68+ .eventSubscriptionDAO ()
69+ .update (JsonUtils .readValue (jsonObj .toString (), EventSubscription .class ));
70+ }
6971 }
7072 }
7173 }
You can’t perform that action at this time.
0 commit comments