aboutsummaryrefslogtreecommitdiffstats
path: root/ansible-adapter
diff options
context:
space:
mode:
authorezhil <ezhrajam@in.ibm.com>2018-12-26 16:04:52 +0530
committerezhil <ezhrajam@in.ibm.com>2018-12-26 16:05:06 +0530
commitdc3aac0ffdc29304b793e201988413cce25d6903 (patch)
tree5bfb61856f238abae92c82b0a24542636c10b114 /ansible-adapter
parent5df4fb30eaf3bbbd6ac5802a8f75fcf8c19d4e6f (diff)
Fixed sonar fix in AnsibleMessageParser.java
Fixed sonar issues Issue-ID: CCSDK-874 Change-Id: Ic4cc98be436cc746df06b3b3f01dca40ecc7b888 Signed-off-by: ezhil <ezhrajam@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.java9
1 files changed, 7 insertions, 2 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 0f286257..6e2244ff 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
@@ -6,6 +6,8 @@
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -151,6 +153,7 @@ public class AnsibleMessageParser {
ansibleResult = new AnsibleResult(code, msg);
} catch (JSONException e) {
+ LOGGER.error("JSON exception", e);
ansibleResult = new AnsibleResult(600, "Error parsing response = " + input + ". Error = " + e.getMessage());
}
return ansibleResult;
@@ -168,6 +171,7 @@ public class AnsibleMessageParser {
JSONObject postResponse = new JSONObject(input);
ansibleResult = parseGetResponseNested(ansibleResult, postResponse);
} catch (JSONException e) {
+ LOGGER.error("JSON exception", e);
ansibleResult = new AnsibleResult(AnsibleResultCodes.INVALID_PAYLOAD.getValue(),
"Error parsing response = " + input + ". Error = " + e.getMessage(), "");
}
@@ -196,7 +200,7 @@ public class AnsibleMessageParser {
// Results are available. process them
// Results is a dictionary of the form
- // {host :{status:s, group:g, message:m, hostname:h}, ...}
+
LOGGER.info("Processing results in response");
JSONObject results = postRsp.getJSONObject("Results");
LOGGER.info("Get JSON dictionary from Results ..");
@@ -214,10 +218,11 @@ public class AnsibleMessageParser {
LOGGER.info("Code = {}, Message = {}", subCode, message);
- if (subCode != 200 || !message.equals("SUCCESS")) {
+ if (subCode != 200 || !("SUCCESS").equals(message)) {
finalCode = AnsibleResultCodes.REQ_FAILURE.getValue();
}
} catch (JSONException e) {
+ LOGGER.error("JSON exception", e);
ansibleResult.setStatusCode(AnsibleResultCodes.INVALID_RESPONSE.getValue());
ansibleResult.setStatusMessage(String.format(
"Error processing response message = %s from host %s", results.getString(host), host));