diff options
author | Mamtha <mamtha.sabesan@in.ibm.com> | 2020-04-18 01:11:43 +0530 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2020-04-21 13:36:54 +0000 |
commit | 9ad0d913dc0e3188d3af153c606d47faf834d11e (patch) | |
tree | 602749b1e85f52ea523dabf5f1dd7ced3fcbabd3 | |
parent | b7e91dd7ef25b497f2358a71e059f48fb657b6c1 (diff) |
Reduce code smells
Issue-ID: APPC-1858
Change-Id: Id6dde417125b0c51426284dbcfa27cb7b8802822
Signed-off-by: Mamtha <mamtha.sabesan@in.ibm.com>
-rw-r--r-- | appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/model/AnsibleMessageParser.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/model/AnsibleMessageParser.java b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/model/AnsibleMessageParser.java index fc38b550a..1ecb37501 100644 --- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/model/AnsibleMessageParser.java +++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/model/AnsibleMessageParser.java @@ -257,15 +257,12 @@ public class AnsibleMessageParser { if (subCode != 200 || !(("SUCCESS").equals(message))) { finalCode = AnsibleResultCodes.REQ_FAILURE.getValue(); } - if ((hostResponse.optJSONObject("Output")) != null) { - if ((hostResponse.optJSONObject("Output").optJSONObject("info")) != null) { - if ((hostResponse.optJSONObject("Output").optJSONObject("info") - .optJSONObject("configData")) != null) { - config = hostResponse.optJSONObject("Output").optJSONObject("info") - .optJSONObject("configData"); - - ansibleResult.setconfigData(config.toString()); - } + if ((hostResponse.optJSONObject(OUTPUT_OPT_KEY)) != null) { + JSONObject hostResponseObjectInfo = hostResponse.optJSONObject(OUTPUT_OPT_KEY).optJSONObject("info"); + JSONObject hostResponseConfigData = hostResponseObjectInfo.optJSONObject("configData"); + if ((hostResponseObjectInfo != null) && hostResponseConfigData != null) { + config = hostResponseConfigData; + ansibleResult.setconfigData(config.toString()); } } } catch (JSONException e) { @@ -387,14 +384,14 @@ public class AnsibleMessageParser { } - private boolean varObjContainsNoData(Object obj) { + /*private boolean varObjContainsNoData(Object obj) { if (obj instanceof String) { if (StringUtils.startsWith(obj.toString(), "$") || StringUtils.isEmpty(obj.toString())) return true; } return false; - } + }*/ private boolean dataIsVariable(String payload) { if (StringUtils.startsWith(payload, "$") || StringUtils.isEmpty(payload)) |