diff options
author | Vijay Venkatesh Kumar <vv770d@att.com> | 2019-02-04 15:33:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-04 15:33:54 +0000 |
commit | dfb5588c61ad49a5fdbc96d7a3dda5e5f887438c (patch) | |
tree | c9a9af07dee3706766d160e19a06b5a6553aac52 /src | |
parent | 771c3061226c7696b4ba272335f1e7297da428c3 (diff) | |
parent | 20af8bbe52d8c86a701026c033a83fcfd0a86fc5 (diff) |
Merge "Multiple Sonar Fixes"
Diffstat (limited to 'src')
3 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/org/onap/dcae/collectors/restconf/common/AnyNode.java b/src/main/java/org/onap/dcae/collectors/restconf/common/AnyNode.java index 4d271a2..860fecc 100755 --- a/src/main/java/org/onap/dcae/collectors/restconf/common/AnyNode.java +++ b/src/main/java/org/onap/dcae/collectors/restconf/common/AnyNode.java @@ -26,12 +26,16 @@ import io.vavr.control.Option; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.stream.StreamSupport; import static io.vavr.API.Set; public class AnyNode { + private static final Logger log = LoggerFactory.getLogger(AnyNode.class); + private Object obj; private AnyNode(Object object) { @@ -85,11 +89,12 @@ public class AnyNode { public Option<AnyNode> getAsOption(String key) { try { AnyNode value = get(key); - if (value.toString().equals("null")) { + if ("null".equals(value.toString())) { return Option.none(); } return Option.some(value); } catch (JSONException ex) { + log.error(ex.getMessage(), ex); return Option.none(); } } diff --git a/src/main/java/org/onap/dcae/collectors/restconf/common/HttpMethod.java b/src/main/java/org/onap/dcae/collectors/restconf/common/HttpMethod.java index 9453e1c..b5c8e71 100755 --- a/src/main/java/org/onap/dcae/collectors/restconf/common/HttpMethod.java +++ b/src/main/java/org/onap/dcae/collectors/restconf/common/HttpMethod.java @@ -27,19 +27,19 @@ public enum HttpMethod { if (s == null) { return null; } - if (s.equalsIgnoreCase("get")) { + if ("get".equalsIgnoreCase(s)) { return GET; } - if (s.equalsIgnoreCase("post")) { + if ("post".equalsIgnoreCase(s)) { return POST; } - if (s.equalsIgnoreCase("put")) { + if ("put".equalsIgnoreCase(s)) { return PUT; } - if (s.equalsIgnoreCase("delete")) { + if ("delete".equalsIgnoreCase(s)) { return DELETE; } - if (s.equalsIgnoreCase("patch")) { + if ("patch".equalsIgnoreCase(s)) { return PATCH; } throw new IllegalArgumentException("Invalid value for HTTP Method: " + s); diff --git a/src/main/java/org/onap/dcae/collectors/restconf/common/RestapiCallNode.java b/src/main/java/org/onap/dcae/collectors/restconf/common/RestapiCallNode.java index c7310d4..33abca9 100755 --- a/src/main/java/org/onap/dcae/collectors/restconf/common/RestapiCallNode.java +++ b/src/main/java/org/onap/dcae/collectors/restconf/common/RestapiCallNode.java @@ -115,7 +115,7 @@ public class RestapiCallNode { log.error("Error sending the request: " + e.getMessage(), e); String prefix = parseParam(paramMap, "responsePrefix", false, null); - if (retryPolicy == null || shouldRetry == false) { + if (null == retryPolicy || !shouldRetry) { setFailureResponseStatus(ctx, prefix, e.getMessage(), r); } else { if (retryCount == null) { @@ -183,7 +183,6 @@ public class RestapiCallNode { String var1 = template.substring(i1 + 2, i2); String value1 = format == Format.XML ? XmlJsonUtil.getXml(mm, var1) : XmlJsonUtil.getJson(mm, var1); - // log.info(" " + var1 + ": " + value1); if (value1 == null || value1.trim().length() == 0) { // delete the whole element (line) int i3 = template.lastIndexOf('\n', i1); |