summaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src
diff options
context:
space:
mode:
authorsurya-huawei <a.u.surya@huawei.com>2017-09-17 22:29:09 +0530
committersurya-huawei <a.u.surya@huawei.com>2017-09-17 22:37:55 +0530
commit43c6f425177393be30c3f065522c9ad9bc340639 (patch)
treed37de497fb27ccb64eedfac31562318e56c34617 /aai-service/provider/src
parent331e512b29fa7bf5de5c20e5c913677f11979e4d (diff)
Fix Sonar Issues in sli/adapter module
one major issue * Use try with resources instead of try Issue-Id: CCSDK-87 Change-Id: Iff46703282a6b9ccb3b61c29495c81a49aaed5da Signed-off-by: surya-huawei <a.u.surya@huawei.com>
Diffstat (limited to 'aai-service/provider/src')
-rw-r--r--aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java11
1 files changed, 1 insertions, 10 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java
index ef1bc02d..e1fa9070 100644
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java
@@ -76,7 +76,6 @@ public class AAIServiceActivator implements BundleActivator {
}
Properties properties = new Properties();
- InputStream input = null;
// find aaiclient config file
File[] files = findFiles(configDirectory, DEFAULT_CONFIG_FILE_NAME);
@@ -84,20 +83,12 @@ public class AAIServiceActivator implements BundleActivator {
// read the aai config data
if(files != null && files.length > 0) {
LOG.debug("AAIService config file exists and it is named :" + files[0].getAbsolutePath() );
- try {
- input = new FileInputStream(files[0]);
+ try ( InputStream input = new FileInputStream(files[0])) {
properties.load(input);
LOG.debug("Loaded AAI Client properties from " + files[0].getAbsolutePath());
} catch (IOException exc) {
LOG.warn("Problem loading AAI Client properties from " + files[0].getAbsolutePath(), exc);
} finally {
- if(input != null ) {
- try {
- input.close();
- } catch(Exception exc) {
- // ignore
- }
- }
int size = properties.keySet().size() ;
if(size == 0) {
LOG.debug(files[0].getAbsolutePath() + " contained no entries. Adding the default entry");