Fix sonar warnings in sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DatastoreContextConfigAdminOverlay.java
index abf07ecb40ea94e01ff965eaaa370bc256f24793..23fcf19ec23966d0e6d626460e9e822467a8b59a 100644 (file)
@@ -60,7 +60,8 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
         this.listener = listener;
     }
 
-    @SuppressWarnings("checkstyle:IllegalCatch")
+    @SuppressWarnings({"checkstyle:IllegalCatch",
+        "squid:S1166" /*  Exception handlers should preserve the original exception */})
     private void overlaySettings(ServiceReference<ConfigurationAdmin> configAdminServiceReference) {
         try {
             ConfigurationAdmin configAdmin = bundleContext.getService(configAdminServiceReference);
@@ -71,10 +72,8 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable {
 
                 LOG.debug("Overlaying settings: {}", properties);
 
-                if (introspector.update(properties)) {
-                    if (listener != null) {
-                        listener.onDatastoreContextUpdated(introspector.newContextFactory());
-                    }
+                if (introspector.update(properties) && listener != null) {
+                    listener.onDatastoreContextUpdated(introspector.newContextFactory());
                 }
             } else {
                 LOG.debug("No Configuration found for {}", CONFIG_ID);