Updated XSD Model and path properties
[ccsdk/sli/adaptors.git] / aai-service / provider / src / main / java / org / onap / ccsdk / sli / adaptors / aai / AAIServiceActivator.java
old mode 100644 (file)
new mode 100755 (executable)
index e1fa907..37a207f
@@ -76,6 +76,7 @@ public class AAIServiceActivator implements BundleActivator {
                }
 
                Properties properties = new Properties();
+               InputStream input = null;
 
                // find aaiclient config file
                File[] files = findFiles(configDirectory, DEFAULT_CONFIG_FILE_NAME);
@@ -83,12 +84,20 @@ 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 ( InputStream input = new FileInputStream(files[0])) {
+                       try {
+                               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");
@@ -148,13 +157,13 @@ public class AAIServiceActivator implements BundleActivator {
                if (sdnConfigDirectory == null || sdnConfigDirectory.isEmpty()) {
                        String filename = DEFAULT_SDNC_PROPERTY_FILE;
                File file = new File(filename);
-               if(file.exists()) {
+               if(file != null && file.exists()) {
                        propertiesPath = filename;
                        LOG.info("Using property file (1): " + propertiesPath);
                } else {
                        filename = BVC_PROPERTY_FILE;
                        file = new File(filename);
-                       if(file.exists()) {
+                       if(file != null && file.exists()) {
                                propertiesPath = filename;
                                LOG.info("Using property file (1): " + propertiesPath);
                        } else {
@@ -170,13 +179,13 @@ public class AAIServiceActivator implements BundleActivator {
                if(!propFile.exists()) {
                        String filename = DEFAULT_SDNC_PROPERTY_FILE;
                File file = new File(filename);
-               if(file.exists()) {
+               if(file != null && file.exists()) {
                        propertiesPath = filename;
                        LOG.info("Using property file (1): " + propertiesPath);
                } else {
                        filename = BVC_PROPERTY_FILE;
                        file = new File(filename);
-                       if(file.exists()) {
+                       if(file != null && file.exists()) {
                                propertiesPath = filename;
                                LOG.info("Using property file (1): " + propertiesPath);
                        } else {