Fix Blocker/Critical sonar issues 07/15407/6
authorshashikanth <shashikanth.vh@huawei.com>
Tue, 26 Sep 2017 08:11:49 +0000 (13:41 +0530)
committerPatrick Brady <pb071s@att.com>
Wed, 27 Sep 2017 22:05:28 +0000 (22:05 +0000)
Fix Blocker/Critical sonar issues in appc module
https://sonar.onap.org/component_issues?id=org.openecomp.appc%3Aappc#resolved=false|severities=BLOCKER|fileUuids=AV36PknS89V-MRZU58_f

Fixed issue Close "FileInputStream".

Issue-Id: APPC-186
Change-Id: I2fab5e54735992a4cbf2972628574edd17905fe3
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
appc-config/appc-config-adaptor/provider/src/main/java/org/openecomp/appc/ccadaptor/CCAActivator.java

index 5863c1d..96cda9c 100644 (file)
@@ -70,28 +70,14 @@ public class CCAActivator implements BundleActivator
         if (!propFile.exists())
             throw new ConfigurationException("Missing configuration properties file: " + propFile);
 
-        InputStream in = new FileInputStream(propFile);
-        try
-        {
+        try(InputStream in = new FileInputStream(propFile)) {
             props.load(in);
+            log.info("Loaded properties: ");
         }
         catch (Exception e)
         {
             throw new ConfigurationException("Could not load properties file " + propFileName, e);
         }
-        finally
-        {
-            try
-            {
-                in.close();
-            }
-            catch (Exception e)
-            {
-                log.warn("Could not close FileInputStream", e);
-            }
-        }
-
-        log.info("Loaded properties: ");
 
         // Advertise adaptor
         ConfigComponentAdaptor adaptor = new ConfigComponentAdaptor(props);