summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);