summaryrefslogtreecommitdiffstats
path: root/restconf-client
diff options
context:
space:
mode:
authorDan Timoney <dt5972@att.com>2018-09-11 20:54:56 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-11 20:54:56 +0000
commitf7086e83c97a72be14ef6813b3c1f8bd0546452e (patch)
tree49f4dc30e48141fb6a5609aab9c0a51c8a42119b /restconf-client
parent72e46e2c1d7ab69503a26a545ed7ef1a49f2fb43 (diff)
parent056df35d0f9b894c1adf8ea9a2d9bdc21497a0e8 (diff)
Merge "Fix for sonar critical issues."
Diffstat (limited to 'restconf-client')
-rw-r--r--restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java5
-rw-r--r--restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java18
-rw-r--r--restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventHandler.java6
-rw-r--r--restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventProcessor.java17
-rw-r--r--restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java5
5 files changed, 26 insertions, 25 deletions
diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java
index c5f73305b..42caf3685 100644
--- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java
+++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java
@@ -90,11 +90,6 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin {
private static final Logger log = LoggerFactory.getLogger(
RestconfApiCallNode.class);
- /**
- * Creates an instance of restconf api call node.
- */
- public RestconfApiCallNode() {
- }
/**
* Sends the restconf request using the parameters map and the memory
diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java
index e066671b1..0f9c9401c 100644
--- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java
+++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java
@@ -200,13 +200,17 @@ public final class RestconfApiUtils {
if (dir.exists()) {
File[] files = dir.listFiles();
if (files != null) {
- for (File file : files) {
- if (file.isFile() && file.getName().endsWith(YANG)) {
- yangFiles.add(file);
- } else if (file.isDirectory()) {
- getYangFiles(file, yangFiles);
- }
- }
+ processFiles(files, yangFiles);
+ }
+ }
+ }
+
+ private static void processFiles(File[] files, List<File> yangFiles) {
+ for (File file : files) {
+ if (file.isFile() && file.getName().endsWith(YANG)) {
+ yangFiles.add(file);
+ } else if (file.isDirectory()) {
+ getYangFiles(file, yangFiles);
}
}
}
diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventHandler.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventHandler.java
index 155656e27..a76554d5a 100644
--- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventHandler.java
+++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventHandler.java
@@ -40,11 +40,7 @@ class EventHandler implements EventListener {
public void onEvent(InboundEvent event) {
String payload = event.readData();
if (!node.eventQueue().offer(payload)) {
- log.error("Unable to process event "
- + payload + "as processing queue is full");
- throw new RuntimeException("Unable to process event "
- + payload
- + "as processing queue is full");
+ log.error("Unable to process event {} as processing queue is full", payload);
}
}
}
diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventProcessor.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventProcessor.java
index a85876cae..aae808155 100644
--- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventProcessor.java
+++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/EventProcessor.java
@@ -53,17 +53,22 @@ class EventProcessor implements Runnable {
String id = param.get(EVENT_SUBSCRIPTION_ID);
SubscriptionInfo info = node.subscriptionInfoMap().get(id);
if (info != null) {
- SvcLogicContext ctx = new SvcLogicContext();
- for (Map.Entry<String, String> entry : param.entrySet()) {
- ctx.setAttribute(entry.getKey(), entry.getValue());
- }
+ SvcLogicContext ctx = setContext(param);
SvcLogicGraphInfo callbackDG = info.callBackDG();
callbackDG.executeGraph(ctx);
}
} catch (InterruptedException | SvcLogicException e) {
- log.error(e.getMessage());
- throw new RuntimeException(e.getMessage());
+ log.error("Interrupted!", e);
+ Thread.currentThread().interrupt();
}
}
}
+
+ private SvcLogicContext setContext(Map<String, String> param) {
+ SvcLogicContext ctx = new SvcLogicContext();
+ for (Map.Entry<String, String> entry : param.entrySet()) {
+ ctx.setAttribute(entry.getKey(), entry.getValue());
+ }
+ return ctx;
+ }
}
diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java
index 0490b3a51..f5366a544 100644
--- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java
+++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java
@@ -85,7 +85,7 @@ public class RestconfDiscoveryNode implements SvcLogicDiscoveryPlugin {
establishPersistentConnection(paramMap, ctx, subscriberId);
} else {
- log.info("Failed to subscribe " + subscriberId);
+ log.info("Failed to subscribe {}", subscriberId);
throw new SvcLogicException(ctx.getAttribute(RESPONSE_CODE));
}
}
@@ -131,7 +131,8 @@ public class RestconfDiscoveryNode implements SvcLogicDiscoveryPlugin {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- log.error("Exception: " + e.getMessage());
+ log.error("Interrupted!", e);
+ Thread.currentThread().interrupt();
}
}
eventSource.close();