Fix legacy policy payload
[clamp.git] / src / main / java / org / onap / clamp / policy / operational / LegacyOperationalPolicy.java
index dd156d8..0b4040d 100644 (file)
@@ -112,6 +112,12 @@ public class LegacyOperationalPolicy {
             replacePropertiesIfEmpty(policy, "failure_retries", "final_failure_retries");
             replacePropertiesIfEmpty(policy, "failure_exception", "final_failure_exception");
             replacePropertiesIfEmpty(policy, "failure_guard", "final_failure_guard");
+            // Again special case for payload, should remove it if it's there but empty
+            // otherwise policy crashes
+            JsonElement payloadElem = policy.getAsJsonObject().get("payload");
+            if (payloadElem != null && payloadElem.isJsonPrimitive() && payloadElem.getAsString().isEmpty()) {
+                policy.getAsJsonObject().remove("payload");
+            }
         }
         return policyJson;
     }