aboutsummaryrefslogtreecommitdiffstats
path: root/appc-client/client-simulator
diff options
context:
space:
mode:
authorSummers, Gregory (gs2953) <gs2953@att.com>2017-09-19 10:27:30 -0500
committerSummers, Gregory (gs2953) <gs2953@att.com>2017-09-25 14:12:09 -0500
commit34f7372f8a1c398b6af428d87fe6dfc3b8e4ffc8 (patch)
treed5698c552c067b5fc91b6208edae54ee34f69283 /appc-client/client-simulator
parentab6544cf74d4dbb70344177880139e6b394b1ab3 (diff)
Fix Sonar Blocker for resource leak
Issue-ID: APPC-186 Change-Id: Id73e2153b13716706b0dce4204d8c7519840afe3 Signed-off-by: Summers, Gregory (gs2953) <gs2953@att.com>
Diffstat (limited to 'appc-client/client-simulator')
-rw-r--r--appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java43
1 files changed, 21 insertions, 22 deletions
diff --git a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java
index 112932224..3180e7849 100644
--- a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java
+++ b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java
@@ -24,8 +24,13 @@
package org.openecomp.appc.simulator.client.impl;
-import org.openecomp.appc.client.lcm.api.*;
-import org.openecomp.appc.client.lcm.exceptions.*;
+import org.openecomp.appc.client.lcm.api.AppcClientServiceFactoryProvider;
+import org.openecomp.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory;
+import org.openecomp.appc.client.lcm.api.ApplicationContext;
+import org.openecomp.appc.client.lcm.api.LifeCycleManagerStateful;
+import org.openecomp.appc.client.lcm.api.ResponseHandler;
+
+import org.openecomp.appc.client.lcm.exceptions.AppcClientException;
import org.openecomp.appc.simulator.client.RequestHandler;
import com.att.eelf.configuration.EELFLogger;
@@ -34,7 +39,11 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Properties;
@@ -71,22 +80,15 @@ public class JsonRequestHandler implements RequestHandler {
}
private HashMap<String,String> prepareExceptionsMap() {
- exceptRpcMap = new HashMap<String, String>();
+ exceptRpcMap = new HashMap<>();
- String line;
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new FileReader(properties.getProperty("client.rpc.exceptions.map.file")));
- } catch (FileNotFoundException e) {
- return exceptRpcMap;
- }
-
- try {
- while ((line = reader.readLine()) != null)
- {
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(properties.getProperty(
+ "client.rpc.exceptions.map.file")))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
String[] parts = line.split(":", 2);
- if (parts.length >= 2)
- {
+ if (parts.length >= 2) {
String key = parts[0];
String value = parts[1];
exceptRpcMap.put(key, value);
@@ -94,15 +96,12 @@ public class JsonRequestHandler implements RequestHandler {
System.out.println("ignoring line: " + line);
}
}
+ } catch (FileNotFoundException e) {
+ return exceptRpcMap;
} catch (IOException e) {
e.printStackTrace();
}
- try {
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
return exceptRpcMap;
}