Fix (and suppress) some static code analysis warnings in blueprint
[controller.git] / opendaylight / blueprint / src / main / java / org / opendaylight / controller / blueprint / BlueprintContainerRestartServiceImpl.java
index 5adb4e51a60c8c3e9674bf03e244ab6da969142c..7985c5bce00e2090016986394bc17287033b866e 100644 (file)
@@ -131,8 +131,9 @@ class BlueprintContainerRestartServiceImpl implements AutoCloseable, BlueprintCo
         // restart config modules.
         final CountDownLatch containerCreationComplete = new CountDownLatch(containerBundles.size());
         ServiceRegistration<?> eventHandlerReg = registerEventHandler(forBundle.getBundleContext(), event -> {
-            LOG.debug("handleEvent {} for bundle {}", event.getTopic(), event.getProperty(EventConstants.BUNDLE));
-            if (containerBundles.contains(event.getProperty(EventConstants.BUNDLE))) {
+            final Bundle bundle = (Bundle) event.getProperty(EventConstants.BUNDLE);
+            LOG.debug("handleEvent {} for bundle {}", event.getTopic(), bundle);
+            if (containerBundles.contains(bundle)) {
                 containerCreationComplete.countDown();
             }
         });
@@ -236,14 +237,13 @@ class BlueprintContainerRestartServiceImpl implements AutoCloseable, BlueprintCo
             return;
         }
 
-        ConfigSubsystemFacade configFacade = configFacadeFactory.createFacade("BlueprintContainerRestartService");
-        try {
+        try (ConfigSubsystemFacade configFacade = configFacadeFactory.createFacade(
+                "BlueprintContainerRestartService")) {
             restartConfigModules(configModules, configFacade);
         } catch (ParserConfigurationException | DocumentedException | ValidationException
                 | ConflictingVersionException e) {
             LOG.error("Error restarting config modules", e);
         } finally {
-            configFacade.close();
             bundleContext.ungetService(configFacadeFactoryRef);
         }