Fix handling of non-OSGi
[ccsdk/sli/adaptors.git] / aai-service / provider / src / main / java / org / onap / ccsdk / sli / adaptors / aai / AAIRequest.java
index 0515218..9facab8 100755 (executable)
@@ -162,8 +162,11 @@ public abstract class AAIRequest {
         AAIRequest.configProperties = props;
         AAIRequest.aaiService = aaiService;
 
+        InputStream in = null;
+
         try
         {
+            LOG.info("Loading aai-path.properties via OSGi");
             URL url = null;
             Bundle bundle = FrameworkUtil.getBundle(AAIService.class);
             if(bundle != null) {
@@ -176,7 +179,19 @@ public abstract class AAIRequest {
                 url = aaiService.getClass().getResource("/aai-path.properties");
             }
 
-            InputStream in = url.openStream();
+            in = url.openStream();
+        }
+        catch (NoClassDefFoundError|Exception e) {
+            LOG.info("Loading aai-path.properties from jar");
+            in = AAIRequest.class.getResourceAsStream("/aai-path.properties");
+
+        }
+
+        if (in == null) {
+            return;
+        }
+
+        try {
             Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8);
 
             Properties properties = new Properties();