summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDriptaroop Das <driptaroop.das@in.ibm.com>2019-01-23 14:22:46 +0530
committerDriptaroop Das <driptaroop.das@in.ibm.com>2019-01-23 14:22:59 +0530
commit20af8bbe52d8c86a701026c033a83fcfd0a86fc5 (patch)
treec46f03885b8af67a200effc8d65285cda168edc6 /src/main
parent1fb99ede30dc9432c6fe69fa9c62bbb59d69cca5 (diff)
Multiple Sonar Fixes
Multiple Sonar Fixes Issue-ID: DCAEGEN2-1114 Change-Id: I6fbb847ca16710f9f93ff8bd2dd973125719e19b Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/java/org/onap/dcae/collectors/restconf/common/AnyNode.java7
-rwxr-xr-xsrc/main/java/org/onap/dcae/collectors/restconf/common/HttpMethod.java10
-rwxr-xr-xsrc/main/java/org/onap/dcae/collectors/restconf/common/RestapiCallNode.java3
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);