From e8781ca0f0ad43078ae6f75c0da4f8eef067fac8 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Fri, 29 May 2020 14:40:52 +0200 Subject: [PATCH] Cleanup DataBrokerTestModule error reporting 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 (cherry picked from commit 4e78a1e85ca3bd04a204bb05ab3fa1695cbbf94b) --- .../mdsal/binding/testutils/DataBrokerTestModule.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/binding/mdsal-binding-test-utils/src/main/java/org/opendaylight/mdsal/binding/testutils/DataBrokerTestModule.java b/binding/mdsal-binding-test-utils/src/main/java/org/opendaylight/mdsal/binding/testutils/DataBrokerTestModule.java index 234a4cdcb3..1560795283 100644 --- a/binding/mdsal-binding-test-utils/src/main/java/org/opendaylight/mdsal/binding/testutils/DataBrokerTestModule.java +++ b/binding/mdsal-binding-test-utils/src/main/java/org/opendaylight/mdsal/binding/testutils/DataBrokerTestModule.java @@ -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.BindingToNormalizedNodeCodec; 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); } } -- 2.36.6