From ac453f1bde56bf95b263113fd475ceee80ac9117 Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Thu, 7 Sep 2017 18:40:47 +0530 Subject: Fix sonar issues for ccsdk plugin few major issues https://sonar.onap.org/dashboard/index?id=org.onap.ccsdk.sli.plugins%3Arestapi-call-node-provider%3Asrc%2Fmain%2Fjava%2Forg%2Fonap%2Fccsdk%2Fsli%2Fplugins%2Frestapicall%2FRestapiCallNode.java Issue-ID: SDNC-75 Change-Id: Ida6ea182545bf57513bcd958519e3b50dfa004b2 Signed-off-by: surya-huawei --- .../sli/plugins/restapicall/RestapiCallNode.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java index fb7722686..7ddeb4269 100644 --- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java +++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java @@ -173,7 +173,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { if (retryCount < retryPolicy.getMaximumRetries() + 1) { URI uri = new URI(paramMap.get("restapiUrl")); String hostname = uri.getHost(); - String retryString = retryPolicy.getNextHostName((uri.toString())); + String retryString = retryPolicy.getNextHostName(uri.toString()); URI uriTwo = new URI(retryString); URI retryUri = UriBuilder.fromUri(uri).host(uriTwo.getHost()).port(uriTwo.getPort()).scheme( uriTwo.getScheme()).build(); @@ -212,7 +212,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { p.responsePrefix = parseParam(paramMap, "responsePrefix", false, null); p.listNameList = getListNameList(paramMap); String skipSendingStr = paramMap.get("skipSending"); - p.skipSending = skipSendingStr != null && skipSendingStr.equalsIgnoreCase("true"); + p.skipSending = "true".equalsIgnoreCase(skipSendingStr); p.convertResponse = Boolean.valueOf(parseParam(paramMap, "convertResponse", false, "true")); p.trustStoreFileName = parseParam(paramMap, "trustStoreFileName", false, null); p.trustStorePassword = parseParam(paramMap, "trustStorePassword", false, null); @@ -228,9 +228,9 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { protected Set getListNameList(Map paramMap) { Set ll = new HashSet(); - for (String key : paramMap.keySet()) - if (key.startsWith("listName")) - ll.add(paramMap.get(key)); + for (Map.Entry entry : paramMap.entrySet()) + if (entry.getKey().startsWith("listName")) + ll.add(entry.getValue()); return ll; } @@ -503,12 +503,12 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { } protected void setFailureResponseStatus(SvcLogicContext ctx, String prefix, String errorMessage, HttpResponse r) { - r = new HttpResponse(); - r.code = 500; - r.message = errorMessage; + HttpResponse resp = new HttpResponse(); + resp.code = 500; + resp.message = errorMessage; String pp = prefix != null ? prefix + '.' : ""; - ctx.setAttribute(pp + "response-code", String.valueOf(r.code)); - ctx.setAttribute(pp + "response-message", r.message); + ctx.setAttribute(pp + "response-code", String.valueOf(resp.code)); + ctx.setAttribute(pp + "response-message", resp.message); } protected void setResponseStatus(SvcLogicContext ctx, String prefix, HttpResponse r) { @@ -633,7 +633,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { String pp = p.responsePrefix != null ? p.responsePrefix + '.' : ""; - String req = null; + String req; if (p.templateFileName == null) { log.info("No template file name specified. Using default UEB template: " + defaultUebTemplateFileName); @@ -679,7 +679,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { p.rootVarName = parseParam(paramMap, "rootVarName", false, null); p.responsePrefix = parseParam(paramMap, "responsePrefix", false, null); String skipSendingStr = paramMap.get("skipSending"); - p.skipSending = skipSendingStr != null && skipSendingStr.equalsIgnoreCase("true"); + p.skipSending = "true".equalsIgnoreCase(skipSendingStr); return p; } -- cgit 1.2.3-korg