aboutsummaryrefslogtreecommitdiffstats
path: root/lib/network-prioritization
diff options
context:
space:
mode:
authorLiard Samuel <samuel.liard@orange.com>2021-10-08 09:21:18 +0200
committerhighstreetherbert <herbert.eiselt@highstreet-technologies.com>2021-11-19 11:25:38 +0100
commit6945b75aac0e6bc2bad6f824769b32842f06bc46 (patch)
treefb99e802250d9efd8ac5c75df85a76431bff3ba4 /lib/network-prioritization
parent71031b0b238ee51affd8135fdd648d9a70a6970b (diff)
Fix sonar Security Hotspots
Issue-ID: CCSDK-3491 Signed-off-by: sliard <samuel.liard@gmail.com> Change-Id: I33787ccca2a8acd8085db6b2a915e8f2ac2511ec Signed-off-by: Dan Timoney <dtimoney@att.com> Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'lib/network-prioritization')
-rw-r--r--lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/api/NpmServiceManagerImpl.java4
-rw-r--r--lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/utils/NpmUtils.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/api/NpmServiceManagerImpl.java b/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/api/NpmServiceManagerImpl.java
index 2cdef3537..9016579bc 100644
--- a/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/api/NpmServiceManagerImpl.java
+++ b/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/api/NpmServiceManagerImpl.java
@@ -415,7 +415,9 @@ public class NpmServiceManagerImpl implements NpmServiceManager {
try {
logger.trace("Initializing NPM Configurations from:({})", configFilePath);
if (new File(configFilePath).exists()) {
- npmConfigurations.load(new FileInputStream(configFilePath));
+ try (FileInputStream configInputStream = new FileInputStream(configFilePath)) {
+ npmConfigurations.load(configInputStream);
+ }
} else {
logger.warn("Config File:({}) not found, Initializing NPM with default configurations.", configFilePath);
configFilePath = "properties" + File.separator + NpmConstants.NPM_CONFIG_PROPERTIES_FILE_NAME;
diff --git a/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/utils/NpmUtils.java b/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/utils/NpmUtils.java
index 735d6d91f..8b74e318b 100644
--- a/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/utils/NpmUtils.java
+++ b/lib/network-prioritization/src/main/java/org/onap/ccsdk/features/lib/npm/utils/NpmUtils.java
@@ -61,7 +61,7 @@ public class NpmUtils {
mapper.enable(SerializationFeature.INDENT_OUTPUT);
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(instance);
} catch (JsonProcessingException e) {
- e.printStackTrace();
+ logger.warn(e.getMessage(), e);
}
return null;
}