summaryrefslogtreecommitdiffstats
path: root/profiles/http/src
diff options
context:
space:
mode:
authorKanagaraj Manickam <kanagaraj.manickam@huawei.com>2018-03-15 08:42:30 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-15 08:42:30 +0000
commitfdf7d0321990e7f81df043103e739bc982d939df (patch)
treea66e27aaf33991f7dee35dd780fbdc2db8afcb54 /profiles/http/src
parentc18e6f5e3daf08067aca95504c2deac07cd00b73 (diff)
parent34c8e8c890a8a53e49aadcbc1bca567a93b11048 (diff)
Merge "HTTP body validation reports invalid error"
Diffstat (limited to 'profiles/http/src')
-rw-r--r--profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java
index 43772e56..52b7571d 100644
--- a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java
+++ b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java
@@ -385,15 +385,17 @@ public class OnapCommandSchemaHttpLoader {
}
String body = String.valueOf(bodyString);
- JSONObject obj = null;
- try {
- obj = new ObjectMapper().readValue(body, JSONObject.class);
- } catch (IOException e1) { // NOSONAR
- errorList.add(OnapCommandHttpConstants.HTTP_BODY_FAILED_PARSING);
- }
- if (obj == null || "".equals(obj.toString())) {
+
+ if (body == null || "".equals(body)) {
errorList.add(OnapCommandHttpConstants.HTTP_BODY_JSON_EMPTY);
+ } else {
+ try {
+ new ObjectMapper().readValue(body, JSONObject.class);
+ } catch (IOException e1) { // NOSONAR
+ errorList.add(OnapCommandHttpConstants.HTTP_BODY_FAILED_PARSING);
+ }
}
+
OnapCommandUtils.parseParameters(body, bodyParamNames);
return bodyParamNames;