Merge "Add RPCs for vCPE"
authorDan Timoney <dtimoney@att.com>
Thu, 21 Sep 2017 17:42:35 +0000 (17:42 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 21 Sep 2017 17:42:35 +0000 (17:42 +0000)
generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java

index ca95e79..c03bc12 100644 (file)
@@ -22,23 +22,15 @@ public class GenericResourceApiUtil extends MdsalHelper {
 
                File file = new File(PROPERTIES_FILE);
                properties = new Properties();
-               InputStream input = null;
-               if (file.isFile() && file.canRead()) {
-                       try     {
-                               input = new FileInputStream(file);
+               if(file.isFile() && file.canRead()) {
+                       try(InputStream input = new FileInputStream(file)){
                                properties.load(input);
                                LOG.info("Loaded properties from " + PROPERTIES_FILE );
                                setYangMappingProperties(properties);
+                       } catch (IOException e) {
+                               LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e);
                        } catch (Exception e) {
                                LOG.error("Failed to load properties " + PROPERTIES_FILE +"\n",e);
-                       } finally {
-                               if (input != null) {
-                                       try {
-                                               input.close();
-                                       } catch (IOException e) {
-                                               LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e);
-                                       }
-                               }
                        }
                }
        }