summaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-11-10 12:54:21 -0500
committerDan Timoney <dtimoney@att.com>2020-11-10 12:54:21 -0500
commit0c3063e69408fe6a0dff9f8aaf7331e271dc8984 (patch)
treea4e99bb38b6baad1d346fc4b0a2481b38900f5eb /aai-service/provider/src
parent3c5e96dd5a0c72fd76c887a46c95528126ed1d22 (diff)
Fix handling of non-OSGi
Fixed handling of case where aai-service and netbox-client are called outside OSGi container. Change-Id: Ie83dd217a77a021a30d171e0964d9ac709e40cc8 Issue-ID: CCSDK-2976 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'aai-service/provider/src')
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java17
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java2
2 files changed, 17 insertions, 2 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
index 0515218b3..9facab82c 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
@@ -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();
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java
index 9888c838b..743f975b6 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java
@@ -157,7 +157,7 @@ public class AAIServiceProvider implements UtilsProvider {
Object unmasked = gs2Method.invoke(encrSvc, new Object[] { value });
return unmasked.toString();
- } catch (Exception exc) {
+ } catch (Exception|NoClassDefFoundError exc) {
LOG.error("Failure", exc);
return value;
}