Fix (and suppress) some static code analysis warnings in blueprint 98/56098/4
authorMichael Vorburger <vorburger@redhat.com>
Wed, 26 Apr 2017 16:26:18 +0000 (18:26 +0200)
committerMichael Vorburger <vorburger@redhat.com>
Tue, 20 Jun 2017 15:32:19 +0000 (15:32 +0000)
Change-Id: I39a2c07176406d469f18949b30abb3deb3c21f6c
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintContainerRestartServiceImpl.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/ActionProviderBean.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/DataStoreAppConfigMetadata.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/SpecificReferenceListMetadata.java

index f3010a4..7985c5b 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();
             }
         });
index bbd989b..1045715 100644 (file)
@@ -77,7 +77,7 @@ public class ActionProviderBean {
 
     public void init() {
         // First resolve the interface class
-        final Class<RpcService> interfaceClass = getRpcClass(interfaceName);
+        final Class<RpcService> interfaceClass = getRpcClass();
 
         LOG.debug("{}: resolved interface {} to {}", ACTION_PROVIDER, interfaceName, interfaceClass);
 
@@ -102,7 +102,7 @@ public class ActionProviderBean {
     }
 
     @SuppressWarnings("unchecked")
-    private Class<RpcService> getRpcClass(final String interfaceName) {
+    private Class<RpcService> getRpcClass() {
         final Class<?> iface;
 
         try {
index e7152a1..bc4ebe2 100644 (file)
@@ -156,6 +156,7 @@ public class DataStoreAppConfigMetadata extends AbstractDependentComponentFactor
     }
 
     private void readInitialAppConfig(final DataBroker dataBroker) {
+        @SuppressWarnings("resource") // it's closed in the callback
         final ReadOnlyTransaction readOnlyTx = dataBroker.newReadOnlyTransaction();
         CheckedFuture<Optional<DataObject>, ReadFailedException> future = readOnlyTx.read(
                 LogicalDatastoreType.CONFIGURATION, bindingContext.appConfigPath);
index c9aab3b..9a0bd29 100644 (file)
@@ -141,7 +141,7 @@ class SpecificReferenceListMetadata extends AbstractDependentComponentFactoryMet
 
     private Object serviceAdded(ServiceReference<Object> reference) {
         Object service = container().getBundleContext().getService(reference);
-        Object serviceType = reference.getProperty(OpendaylightNamespaceHandler.TYPE_ATTR);
+        String serviceType = (String) reference.getProperty(OpendaylightNamespaceHandler.TYPE_ATTR);
 
         LOG.debug("{}: Service type {} added from bundle {}", logName(), serviceType,
                 reference.getBundle().getSymbolicName());
@@ -166,7 +166,7 @@ class SpecificReferenceListMetadata extends AbstractDependentComponentFactoryMet
         if (isSatisfied()) {
             restartContainer();
         } else {
-            retrievedServiceTypes.add(serviceType.toString());
+            retrievedServiceTypes.add(serviceType);
             retrievedServices.add(service);
 
             if (retrievedServiceTypes.equals(expectedServiceTypes)) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.