diff options
author | 2017-09-07 18:40:47 +0530 | |
---|---|---|
committer | 2017-09-07 19:33:11 +0530 | |
commit | ac453f1bde56bf95b263113fd475ceee80ac9117 (patch) | |
tree | d091a26373099c0a2f03e65a81ac4f6e8442f71e /restapi-call-node/provider/src/main/java/org | |
parent | 69fec3e3ac7b14b17dcc827683caf9b07f4eb842 (diff) |
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 <a.u.surya@huawei.com>
Diffstat (limited to 'restapi-call-node/provider/src/main/java/org')
-rw-r--r-- | restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java | 24 |
1 files 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 fb772268..7ddeb426 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<String> getListNameList(Map<String, String> paramMap) { Set<String> ll = new HashSet<String>(); - for (String key : paramMap.keySet()) - if (key.startsWith("listName")) - ll.add(paramMap.get(key)); + for (Map.Entry<String,String> 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; } |