Fix checkstyle issues to enforce it
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / jmx / InternalJMXRegistrator.java
index 7d0bee25333b84148bfce23e1c09380e169b2149..f4b326ea19bda835075947f625bd631a1dcdabfe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -88,7 +88,8 @@ abstract class InternalJMXRegistrator implements AutoCloseable {
     final synchronized void unregisterMBean(final ObjectName on) {
         // first check that on was registered using this instance
         boolean removed = registeredObjectNames.remove(on);
-        Preconditions.checkState(removed, "Cannot unregister - ObjectName not found in 'registeredObjectNames': %s", on);
+        Preconditions.checkState(removed, "Cannot unregister - ObjectName not found in 'registeredObjectNames': %s",
+                on);
 
         try {
             getMBeanServer().unregisterMBean(on);
@@ -159,7 +160,7 @@ abstract class InternalJMXRegistrator implements AutoCloseable {
         for (ObjectName on : registeredObjectNames) {
             try {
                 getMBeanServer().unregisterMBean(on);
-            } catch (final Exception e) {
+            } catch (final InstanceNotFoundException | MBeanRegistrationException e) {
                 LOG.warn("Ignoring error while unregistering {}", on, e);
             }
         }