Add @SupressFBWarnings around Await.result() 31/84431/4
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 14 Sep 2019 06:27:19 +0000 (08:27 +0200)
committerStephen Kitt <skitt@redhat.com>
Wed, 18 Sep 2019 08:47:05 +0000 (08:47 +0000)
Await.result() is throwing Exceptions we need to catch, raising
the ire of SpotBugs. Suppress that.

Change-Id: I1a880c86a8ab1759c5741dd27c8341d89452c7e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardDataTreeListenerInfoMXBeanImpl.java

index 42ac5a4e396971f49ee25f92cd91792f42f8f8b1..c2e4aab5a428423865a02acc50afa10287bd0753 100644 (file)
@@ -18,6 +18,7 @@ import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Strings;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Collection;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
@@ -215,6 +216,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ
 
     @VisibleForTesting
     @SuppressWarnings("checkstyle:IllegalCatch")
+    @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Akka's Await.result() API contract")
     DataTree getLocalEntityOwnershipShardDataTree() {
         if (localEntityOwnershipShardDataTree == null) {
             try {
index 0dadd69e2f525b25ca94c846e5c0cf8600104779..6c6726ca08d5054d0715ac776fbc6c29152f6858 100644 (file)
@@ -15,6 +15,7 @@ import akka.dispatch.Futures;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.base.Throwables;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -59,7 +60,8 @@ public class ShardDataTreeListenerInfoMXBeanImpl extends AbstractMXBean implemen
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    private static List<DataTreeListenerInfo> getListenerActorsInfo(Collection<ActorSelection> actors) {
+    @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Akka's Await.result() API contract")
+    private static List<DataTreeListenerInfo> getListenerActorsInfo(final Collection<ActorSelection> actors) {
         final Timeout timeout = new Timeout(20, TimeUnit.SECONDS);
         final List<Future<Object>> futureList = new ArrayList<>(actors.size());
         for (ActorSelection actor: actors) {