Fixed sonar issues/code-smells across this file.
Issue-ID: APPC-1256
Change-Id: I70480e3867c0ab49325d10e0ec91e76bf6979c50
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
ansibleResult = new AnsibleResult(code, msg);
} catch (JSONException e) {
ansibleResult = new AnsibleResult(code, msg);
} catch (JSONException e) {
+ LOGGER.error("JSONException: Error parsing response", e);
ansibleResult = new AnsibleResult(600, "Error parsing response = " + input + ". Error = " + e.getMessage());
}
return ansibleResult;
ansibleResult = new AnsibleResult(600, "Error parsing response = " + input + ". Error = " + e.getMessage());
}
return ansibleResult;
JSONObject postResponse = new JSONObject(input);
ansibleResult = parseGetResponseNested(ansibleResult, postResponse);
} catch (JSONException e) {
JSONObject postResponse = new JSONObject(input);
ansibleResult = parseGetResponseNested(ansibleResult, postResponse);
} catch (JSONException e) {
+ LOGGER.error("JSONException: Error parsing response", e);
ansibleResult = new AnsibleResult(AnsibleResultCodes.INVALID_PAYLOAD.getValue(),
"Error parsing response = " + input + ". Error = " + e.getMessage(), "");
}
ansibleResult = new AnsibleResult(AnsibleResultCodes.INVALID_PAYLOAD.getValue(),
"Error parsing response = " + input + ". Error = " + e.getMessage(), "");
}
LOGGER.info("Code = {}, Message = {}", subCode, message);
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) {
finalCode = AnsibleResultCodes.REQ_FAILURE.getValue();
}
} catch (JSONException e) {
+ LOGGER.error("JSONException: Error parsing response", e);
ansibleResult.setStatusCode(AnsibleResultCodes.INVALID_RESPONSE.getValue());
ansibleResult.setStatusMessage(String.format(
"Error processing response message = %s from host %s", results.getString(host), host));
ansibleResult.setStatusCode(AnsibleResultCodes.INVALID_RESPONSE.getValue());
ansibleResult.setStatusMessage(String.format(
"Error processing response message = %s from host %s", results.getString(host), host));