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>
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);