Use try-with-resources
authorStephen Kitt <skitt@redhat.com>
Mon, 15 May 2017 15:56:02 +0000 (17:56 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 17 May 2017 12:12:44 +0000 (12:12 +0000)
This automatically-generated patch replaces explicit Closeable
handling with try-with-resources.

Change-Id: Ib707d30dd9730fed5dacefa60d7f61c9010e2909
Signed-off-by: Stephen Kitt <skitt@redhat.com>
src/main/java/org/opendaylight/controller/blueprint/BlueprintContainerRestartServiceImpl.java

index 5adb4e51a60c8c3e9674bf03e244ab6da969142c..f3010a41387d21d4765b33309b9c45713270c7c1 100644 (file)
@@ -236,14 +236,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);
         }