diff options
author | Dan Timoney <dtimoney@att.com> | 2019-01-07 15:47:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-01-07 15:47:54 +0000 |
commit | 1c79cb2e8fe101e33372756417b186e314069305 (patch) | |
tree | 1a3059f1f86817c8abc6406354923daa5d16286d | |
parent | 1e1272603e33148cf85e3d8ac31c57c76f30bb40 (diff) | |
parent | 9a983c9067de3c79e6ec85c4715e966929771f67 (diff) |
Merge "Sonar fix: AnsibleMessageParser"
-rw-r--r-- | ansible-adapter/ansible-adapter-bundle/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/model/AnsibleMessageParser.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ansible-adapter/ansible-adapter-bundle/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/model/AnsibleMessageParser.java b/ansible-adapter/ansible-adapter-bundle/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/model/AnsibleMessageParser.java index 6e2244ff9..427149ccb 100644 --- a/ansible-adapter/ansible-adapter-bundle/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/model/AnsibleMessageParser.java +++ b/ansible-adapter/ansible-adapter-bundle/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/model/AnsibleMessageParser.java @@ -67,6 +67,7 @@ public class AnsibleMessageParser { private static final String VERSION_OPT_KEY = "Version"; private static final String ACTION_OPT_KEY = "Action"; + private String jsonException = "JSON exception"; private static final Logger LOGGER = LoggerFactory.getLogger(AnsibleMessageParser.class); /** @@ -153,7 +154,7 @@ public class AnsibleMessageParser { ansibleResult = new AnsibleResult(code, msg); } catch (JSONException e) { - LOGGER.error("JSON exception", e); + LOGGER.error(jsonException, e); ansibleResult = new AnsibleResult(600, "Error parsing response = " + input + ". Error = " + e.getMessage()); } return ansibleResult; @@ -171,7 +172,7 @@ public class AnsibleMessageParser { JSONObject postResponse = new JSONObject(input); ansibleResult = parseGetResponseNested(ansibleResult, postResponse); } catch (JSONException e) { - LOGGER.error("JSON exception", e); + LOGGER.error(jsonException, e); ansibleResult = new AnsibleResult(AnsibleResultCodes.INVALID_PAYLOAD.getValue(), "Error parsing response = " + input + ". Error = " + e.getMessage(), ""); } @@ -222,7 +223,7 @@ public class AnsibleMessageParser { finalCode = AnsibleResultCodes.REQ_FAILURE.getValue(); } } catch (JSONException e) { - LOGGER.error("JSON exception", e); + LOGGER.error(jsonException, e); ansibleResult.setStatusCode(AnsibleResultCodes.INVALID_RESPONSE.getValue()); ansibleResult.setStatusMessage(String.format( "Error processing response message = %s from host %s", results.getString(host), host)); |