Check if ConfigAdmin service is there to avoid NPE
@@ -157,20 +157,19 @@ public class ConfigInstaller implements ArtifactInstaller, ConfigurationListener
this, null);
try
{
+ if (getConfigurationAdmin() != null) {
Configuration[] configs = getConfigurationAdmin().listConfigurations(null);
- if (configs != null)
- {
- for (Configuration config : configs)
- {
+ if (configs != null) {
+ for (Configuration config : configs) {
Dictionary<?, ?> dict = config.getProperties();
String fileName = dict != null ? (String) dict.get(DirectoryWatcher.FILENAME) : null;
- if (fileName != null)
- {
+ if (fileName != null) {
pidToFile.put(config.getPid(), fileName);
}
}
}
}
+ }
catch (Exception e)
{
Util.log( context, Logger.LOG_INFO, "Unable to initialize configurations list", e );
