switch from FindBugs to SpotBugs 02/77802/10
authorMichael Vorburger <vorburger@redhat.com>
Wed, 14 Nov 2018 18:28:08 +0000 (19:28 +0100)
committerMichael Vorburger <vorburger@redhat.com>
Mon, 26 Nov 2018 10:09:34 +0000 (10:09 +0000)
The commented out "if" in SyncPlanPushStrategyIncrementalImpl address a
UCF_USELESS_CONTROL_FLOW problem which SpotBugs correctly points out.

The "switch" related change in LLDPLinkAger addresses
DB_DUPLICATE_SWITCH_CLAUSES.

Change-Id: I426632b586b29133350f4050024a9c58d03f5ba9
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImpl.java
applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeaker.java
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAger.java
parent/pom.xml

index 2e69f01900abe50ac0d72985f8e1f6e55d934956..c99d3a3ff715cd4ac338bc6ad41030580e3f325d 100644 (file)
@@ -78,28 +78,28 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
         //resultVehicle = updateTableFeatures(nodeIdent, configTree);
 
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
                 //final ListenableFuture<RpcResult<Void>> singleVoidUpdateResult = Futures.transform(
                 //        Futures.asList Arrays.asList(input, output),
                 //        ReconcileUtil.<UpdateFlowOutput>createRpcResultCondenser("TODO"));
-            }
+            // }
             return addMissingGroups(nodeId, nodeIdent, diffInput.getGroupsToAddOrUpdate(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingGroups"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return addMissingMeters(nodeId, nodeIdent, diffInput.getMetersToAddOrUpdate(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingMeters"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return addMissingFlows(nodeId, nodeIdent, diffInput.getFlowsToAddOrUpdate(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingFlows"),
@@ -107,25 +107,25 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
 
 
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return removeRedundantFlows(nodeId, nodeIdent, diffInput.getFlowsToRemove(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantFlows"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return removeRedundantMeters(nodeId, nodeIdent, diffInput.getMetersToRemove(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantMeters"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return removeRedundantGroups(nodeId, nodeIdent, diffInput.getGroupsToRemove(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantGroups"),
index ac77346ffdc266ce50e6c296325a2a70d534a65d..84358e0bb049df9ecac197684706f7be44e04f6b 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowplugin.applications.lldpspeaker;
 
+import static org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging;
+
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import java.security.NoSuchAlgorithmException;
@@ -133,7 +135,8 @@ public class LLDPSpeaker implements NodeConnectorEventsObserver, Runnable, AutoC
                 if (deviceOwnershipService.isEntityOwned(nodeId.getValue())) {
                     LOG.debug("Node is owned by this controller, sending LLDP packet through port {}",
                             nodeConnectorId.getValue());
-                    packetProcessingService.transmitPacket(nodeConnectorMap.get(ncIID));
+                    addErrorLogging(packetProcessingService.transmitPacket(nodeConnectorMap.get(ncIID)), LOG,
+                            "transmitPacket() failed");
                 } else {
                     LOG.debug("Node {} is not owned by this controller, so skip sending LLDP packet on port {}",
                             nodeId.getValue(), nodeConnectorId.getValue());
index 738ba0299e819b95780a4bc32d9e823495fe7610..afcc2b5e8e8030140dd73ad0b7c4632090ce5000 100644 (file)
@@ -105,11 +105,7 @@ public class LLDPLinkAger implements ConfigurationListener, AutoCloseable {
         Optional.ofNullable(TopologyLLDPDiscoveryProperty.forValue(propertyName)).ifPresent(lldpDiscoveryProperty -> {
             switch (lldpDiscoveryProperty) {
                 case LLDP_SECURE_KEY:
-                    LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
-                    break;
                 case TOPOLOGY_LLDP_INTERVAL:
-                    LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
-                    break;
                 case TOPOLOGY_LLDP_EXPIRATION_INTERVAL:
                     LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
                     break;
index 4b55403e0c7b405d46a59710c915024273ba999c..f98787c0b3bdf2f4184199f697da42a79f495e2b 100644 (file)
@@ -85,8 +85,8 @@
                 </configuration>
             </plugin>
             <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>findbugs-maven-plugin</artifactId>
+                <groupId>com.github.spotbugs</groupId>
+                <artifactId>spotbugs-maven-plugin</artifactId>
                 <configuration>
                     <failOnError>true</failOnError>
                 </configuration>