aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib
diff options
context:
space:
mode:
authorvempo <vitaliy.emporopulo@amdocs.com>2017-09-07 10:52:29 +0300
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-09-07 13:53:33 +0000
commitb7375b2488df93ba9df57ad13ec628bbff663819 (patch)
treee8d372535ab98aa76814e16d301ac32efbeb0c75 /openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib
parent8bd8cee7d620406036e197f540439b1e226506d5 (diff)
Fixed a few static analysis violations
Fixed mostly not closing resources (InputStream, ResultSet) and catching Throwable instead of Exception in some modules. Issue-ID: SDC-291 Change-Id: I34e331cc3b45c4bb3a71c301f50e1706a7b623fd Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java
index 173f9b15b1..b9d03f4d1a 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java
@@ -25,7 +25,9 @@ import org.openecomp.core.factory.api.FactoriesConfiguration;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
+import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -50,12 +52,16 @@ public final class FactoriesConfigImpl implements FactoriesConfiguration {
}
private void init() {
- List<InputStream> factoryConfigIsList = FileUtils.getFileInputStreams(FACTORY_CONFIG_FILE_NAME);
- for (InputStream factoryConfigIs : factoryConfigIsList) {
- factoryMap.putAll(JsonUtil.json2Object(factoryConfigIs, Map.class));
- }
- }
+ List<URL> factoryConfigUrlList = FileUtils.getAllLocations(FACTORY_CONFIG_FILE_NAME);
+ for (URL factoryConfigUrl : factoryConfigUrlList) {
+ try (InputStream stream = factoryConfigUrl.openStream()) {
+ factoryMap.putAll(JsonUtil.json2Object(stream, Map.class));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
}