BUG 2245 - Fix Unnecessary Local Before Return
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / connection / SwitchConnectionProviderImpl.java
index 75f698c44085bf9605e8e04fa6c1b11e00c21dca..002343d75d1c3a82b0dac3fe23d922e913817e63 100644 (file)
@@ -97,9 +97,11 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider {
     @Override
     public ListenableFuture<Boolean> shutdown() {
         LOGGER.debug("Shutdown summoned");
-        //TODO: provide exception in case of: not started, not configured (already stopped)
-        ListenableFuture<Boolean> result = serverFacade.shutdown();
-        return result;
+        if(serverFacade == null){
+            LOGGER.debug("Can not shutdown - not configured or started");
+            throw new IllegalStateException("SwitchConnectionProvider is not started or not configured.");
+        }
+        return serverFacade.shutdown();
     }
 
     @Override