Fix for possible NPE if Bundle is stopped. 88/9888/3
authorEd Warnicke <eaw@cisco.com>
Tue, 12 Aug 2014 15:45:34 +0000 (10:45 -0500)
committerEd Warnicke <eaw@cisco.com>
Tue, 19 Aug 2014 04:54:20 +0000 (04:54 +0000)
Change-Id: Iaf1d44f8b600e69392452b74042812b35e8101de
Signed-off-by: Ed Warnicke <eaw@cisco.com>
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java

index 0a48e6c67dc8cc290c2b81a1b0eb67c05ac7c618..8e9f9978c4dd837334b07db2d1f6c96764e0ede9 100644 (file)
@@ -173,8 +173,12 @@ public class ConfigPersisterActivator implements BundleActivator {
                         if(configs != null && !configs.isEmpty()) {
                             configPusher.pushConfigs(configs);
                         }
-                        registration = context.registerService(ConfigPusher.class.getName(), configPusher, null);
-                        configPusher.process(autoCloseables, platformMBeanServer, persisterAggregator);
+                        if(context != null) {
+                            registration = context.registerService(ConfigPusher.class.getName(), configPusher, null);
+                            configPusher.process(autoCloseables, platformMBeanServer, persisterAggregator);
+                        } else {
+                            logger.warn("Unable to process configs as BundleContext is null");
+                        }
                     } catch (InterruptedException e) {
                         logger.info("ConfigPusher thread stopped",e);
                     }