summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-09-06 17:40:31 +0200
committersebdet <sebastien.determe@intl.att.com>2019-09-06 17:40:31 +0200
commit64d4727e2bb0973cf61a125fed240c8c4952d6ff (patch)
tree4c9f1b350a24b8ca8e7b50492ec9ef9547bb6fd1 /src/main/java/org/onap
parent156d6eac7960290fced027f4211974668ffa1d44 (diff)
Fix legacy policy payload
Ensure payload attribute is well not present if defined as an empty string Issue-ID: CLAMP-484 Change-Id: If6d558c009dd695bfd5f83cf0d50800e12026121 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java
index dd156d8f3..0b4040d0b 100644
--- a/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java
+++ b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java
@@ -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;
}