summaryrefslogtreecommitdiffstats
path: root/ansible-adapter/ansible-adapter-bundle
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2018-12-28 02:47:27 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-28 02:47:27 +0000
commit0dfcae05c64111313f93635a1b9e290370015a95 (patch)
treea9f3058b287b81bedfc39a7e4e474999bec4fa6f /ansible-adapter/ansible-adapter-bundle
parent5d0da5fb1c91586b872bfcc0f2d636ca9648457c (diff)
parentdc3aac0ffdc29304b793e201988413cce25d6903 (diff)
Merge "Fixed sonar fix in AnsibleMessageParser.java"
Diffstat (limited to 'ansible-adapter/ansible-adapter-bundle')
-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 0f2862579..6e2244ff9 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));