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 42ac5a4..c2e4aab 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 0dadd69..6c6726c 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) {

©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.