diff options
author | Kanagaraj Manickam <kanagaraj.manickam@huawei.com> | 2018-03-15 08:42:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-15 08:42:30 +0000 |
commit | fdf7d0321990e7f81df043103e739bc982d939df (patch) | |
tree | a66e27aaf33991f7dee35dd780fbdc2db8afcb54 /profiles/http/src/main | |
parent | c18e6f5e3daf08067aca95504c2deac07cd00b73 (diff) | |
parent | 34c8e8c890a8a53e49aadcbc1bca567a93b11048 (diff) |
Merge "HTTP body validation reports invalid error"
Diffstat (limited to 'profiles/http/src/main')
-rw-r--r-- | profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java | 16 |
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; |