summaryrefslogtreecommitdiffstats
path: root/ansible-adapter
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2019-01-02 16:22:03 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2019-01-02 16:22:11 +0530
commit9a983c9067de3c79e6ec85c4715e966929771f67 (patch)
treec73750248b34c8b56d809fa0e4c36c3ffc2a76c8 /ansible-adapter
parente6eb5bfb02077473d20061bd16faf6c1a6fa4af4 (diff)
Sonar fix: AnsibleMessageParser
Fixed sonar issues/code smells across this file Issue-ID: CCSDK-889 Change-Id: I17520284ad7a74573830ca18de37cbcdcf5d6b6d Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'ansible-adapter')
-rw-r--r--ansible-adapter/ansible-adapter-bundle/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/model/AnsibleMessageParser.java7
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 6e2244ff..427149cc 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));