diff options
Diffstat (limited to 'utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/common/BundleContextFileResolver.java')
-rwxr-xr-x | utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/common/BundleContextFileResolver.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/common/BundleContextFileResolver.java b/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/common/BundleContextFileResolver.java index 9496d90e..356009f3 100755 --- a/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/common/BundleContextFileResolver.java +++ b/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/common/BundleContextFileResolver.java @@ -56,20 +56,22 @@ public class BundleContextFileResolver implements PropertiesFileResolver { */ @Override public Optional<File> resolveFile(final String filename) { - if(FrameworkUtil.getBundle(clazz) == null) { - return Optional.empty(); - } else { - try { - final String pathProperty = FrameworkUtil.getBundle(this.clazz).getBundleContext().getProperty(SDNC_CONFIG_DIR_PROP_KEY); - if(Strings.isNullOrEmpty(pathProperty)) { - return Optional.empty(); - } - final Path dblibPath = Paths.get(pathProperty); - return Optional.of(dblibPath.resolve(filename).toFile()); - } catch(final Exception e) { - LoggerFactory.getLogger(this.getClass()).error("", e); + try { + if (FrameworkUtil.getBundle(clazz) == null) { return Optional.empty(); + } else { + final String pathProperty = FrameworkUtil.getBundle(this.clazz).getBundleContext() + .getProperty(SDNC_CONFIG_DIR_PROP_KEY); + if (Strings.isNullOrEmpty(pathProperty)) { + return Optional.empty(); + } + final Path dblibPath = Paths.get(pathProperty); + return Optional.of(dblibPath.resolve(filename).toFile()); + } + } catch (Exception|NoClassDefFoundError e) { + LoggerFactory.getLogger(this.getClass()).error("", e); + return Optional.empty(); } } |