diff options
-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; |