aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJegadeesh Babu <jegabab1@in.ibm.com>2019-03-31 12:35:47 +0530
committerTakamune Cho <takamune.cho@att.com>2019-04-02 19:36:47 +0000
commitc80a85fa44b0b02efae3935ec79a81c2f5db8820 (patch)
treed2ea7416cb7347039b22f3d3e2a6f16fceff086d
parentf8b68b874a3d01b6c09793db859bf93e7632e1f2 (diff)
Used constants to avoid dup of literals
Sonar fix Issue-ID: APPC-1562 Change-Id: Ic9d14b32f4deac975b46154a2ac8e4664ec11c52 Signed-off-by: Jegadeesh Babu <jegabab1@in.ibm.com>
-rw-r--r--appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java
index 717c39914..6a8664acb 100644
--- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java
+++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java
@@ -168,6 +168,7 @@ public class ChefAdapterImpl implements ChefAdapter {
public void vnfcNodeobjects(Map<String, String> params, SvcLogicContext ctx) throws SvcLogicException {
logger.info("update the nodeObjects of VNF-C");
int code;
+ final String LOG_ERR_METHOD_STR = "vnfcNodeobjects";
try {
chefInfo(params, ctx);
String nodeListS = params.get(NODE_LIST_STR);
@@ -208,12 +209,12 @@ public class ChefAdapterImpl implements ChefAdapter {
}
} catch (JSONException e) {
code = APPC_ERRORCODE;
- logger.error(POSTING_REQUEST_JSON_ERROR_STR + "vnfcNodeobjects", e);
- doFailure(ctx, code, POSTING_REQUEST_JSON_ERROR_STR + "vnfcNodeobjects" + e.getMessage());
+ logger.error(POSTING_REQUEST_JSON_ERROR_STR + LOG_ERR_METHOD_STR, e);
+ doFailure(ctx, code, POSTING_REQUEST_JSON_ERROR_STR + LOG_ERR_METHOD_STR + e.getMessage());
} catch (Exception e) {
code = APPC_ERRORCODE;
- logger.error(POSTING_REQUEST_ERROR_STR + "vnfcNodeobjects", e);
- doFailure(ctx, code, POSTING_REQUEST_ERROR_STR + "vnfcNodeobjects" + e.getMessage());
+ logger.error(POSTING_REQUEST_ERROR_STR + LOG_ERR_METHOD_STR, e);
+ doFailure(ctx, code, POSTING_REQUEST_ERROR_STR + LOG_ERR_METHOD_STR + e.getMessage());
}
}
@@ -600,11 +601,12 @@ public class ChefAdapterImpl implements ChefAdapter {
try {
JSONObject messageJson = new JSONObject(message);
JSONObject node = messageJson.getJSONObject("nodes");
+ final String failed = "failed";
if (node == null) {
logger.debug("Status Complete but node details in the message is null : " + message);
return Boolean.TRUE;
}
- if (node.has("failed") && !(node.isNull("failed")) && (node.getJSONArray("failed").length() != 0)) {
+ if (node.has(failed) && !(node.isNull(failed)) && (node.getJSONArray(failed).length() != 0)) {
logger.debug("Status Complete but one or more Failed nodes ....FAILURE " + message);
return Boolean.TRUE;
}