diff options
author | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2020-04-01 19:58:23 +0000 |
---|---|---|
committer | Kevin Smokowski <kevin.smokowski@att.com> | 2020-04-01 20:14:01 +0000 |
commit | b970a7b46fac32e626acfa23b1e2de9b22da7ff7 (patch) | |
tree | 3f885b81b623ecc4c9a7d9fec0d34c2292396fee /sliPluginUtils/provider/src/main/java | |
parent | 4cbff49506b31844ccda7ca38b3ba7283974475a (diff) |
SliPluginUtils jsonStringToCtx fix
Support null values in jsonStringToCtx in Slipluginutils
Issue-ID: CCSDK-2250
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: I3316fa9e80c9e684fc27d83356bbfad9b1151992
Diffstat (limited to 'sliPluginUtils/provider/src/main/java')
-rw-r--r-- | sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java index ce0f50800..60bb4fd31 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java @@ -70,6 +70,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { private static final String LOG_MSG="extracting list from context memory"; private static final String LOG_MSG1="removing elements from list"; private static final String LENGTH="_length"; + public static final String CTX_NULL_VALUE=""; // ========== CONSTRUCTORS ========== @@ -846,7 +847,11 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { if(!root.endsWith(".")){ root = root + "."; } - ctx.setAttribute(root + key, entry.getValue().getAsString()); + if(entry.getValue().isJsonNull()) { + ctx.setAttribute(root + key, CTX_NULL_VALUE); + }else { + ctx.setAttribute(root + key, entry.getValue().getAsString()); + } } } } @@ -861,6 +866,8 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { handleJsonArray(key, element.getAsJsonArray(), ctx, prefix); } else if (element.isJsonObject()) { writeJsonObject(element.getAsJsonObject(), ctx, prefix + "."); + } else if (element.isJsonNull()) { + ctx.setAttribute(prefix, CTX_NULL_VALUE); } else if (element.isJsonPrimitive()) { ctx.setAttribute(prefix, element.getAsString()); } |