Cleanup DataBrokerTestModule error reporting 89/90089/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 29 May 2020 12:40:52 +0000 (14:40 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 29 May 2020 12:47:55 +0000 (14:47 +0200)
Do not declare RuntimeException as thrown and do not wrap reported
RuntimeExceptions. Also make sure we use IllegalStateException as
the wrapper.

JIRA: MDSAL-556
Change-Id: Ifc47004c6d5cc2c974045c3f4d94154b506c8ebd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-test-utils/src/main/java/org/opendaylight/mdsal/binding/testutils/DataBrokerTestModule.java

index 442519f76aa45a2d94cf2c936cbd43ddd9d912a3..6d87d67129871715f28b6fe2276d72024d2cba33 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.mdsal.binding.testutils;
 
 import com.google.common.annotations.Beta;
+import com.google.common.base.Throwables;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer;
 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest;
@@ -31,8 +32,8 @@ public class DataBrokerTestModule {
     }
 
     // Suppress IllegalCatch because of AbstractDataBrokerTest (change later)
-    @SuppressWarnings({ "checkstyle:IllegalCatch", "checkstyle:IllegalThrows" })
-    public DataBroker getDataBroker() throws RuntimeException {
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    public DataBroker getDataBroker() {
         try {
             // This is a little bit "upside down" - in the future,
             // we should probably put what is in AbstractDataBrokerTest
@@ -43,7 +44,8 @@ public class DataBrokerTestModule {
             dataBrokerTest.setup();
             return dataBrokerTest.getDataBroker();
         } catch (Exception e) {
-            throw new RuntimeException(e);
+            Throwables.throwIfUnchecked(e);
+            throw new IllegalStateException(e);
         }
     }