From 64d4727e2bb0973cf61a125fed240c8c4952d6ff Mon Sep 17 00:00:00 2001 From: sebdet Date: Fri, 6 Sep 2019 17:40:31 +0200 Subject: 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 --- .../org/onap/clamp/policy/operational/LegacyOperationalPolicy.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main/java/org/onap') 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; } -- cgit 1.2.3-korg