From 57e72c9a6325ccead6c9387fd0ba1bca668f8c60 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Wed, 6 May 2020 17:06:51 +0200 Subject: [PATCH] Enforce Spotbugs in test-common module by fixing remaining SpotBugs issues JIRA: TRNSPRTPCE-216 TRNSPRTPCE-248 TRNSPRTPCE-265 Signed-off-by: guillaume.lambert Change-Id: Ie2e8493a3c2d2acd29a782cabaf037e99c7fd28d --- test-common/pom.xml | 6 ------ .../transportpce/test/AbstractDeviceTest.java | 4 ++-- .../opendaylight/transportpce/test/DeviceWrapper.java | 10 ++++++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/test-common/pom.xml b/test-common/pom.xml index 2c16475a2..f636a90ae 100644 --- a/test-common/pom.xml +++ b/test-common/pom.xml @@ -36,10 +36,4 @@ - - - - false - - diff --git a/test-common/src/main/java/org/opendaylight/transportpce/test/AbstractDeviceTest.java b/test-common/src/main/java/org/opendaylight/transportpce/test/AbstractDeviceTest.java index 3321a7f3e..ccb2546c9 100644 --- a/test-common/src/main/java/org/opendaylight/transportpce/test/AbstractDeviceTest.java +++ b/test-common/src/main/java/org/opendaylight/transportpce/test/AbstractDeviceTest.java @@ -9,9 +9,9 @@ package org.opendaylight.transportpce.test; import com.google.common.base.Preconditions; import com.google.common.base.Strings; -import com.google.common.collect.Maps; import java.io.InputStream; import java.util.Collections; +import java.util.HashMap; import java.util.Map; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.common.QName; @@ -33,7 +33,7 @@ public abstract class AbstractDeviceTest { * {@link AbstractDeviceTest#internalStorage} as asynchronized {@link Map}. */ public AbstractDeviceTest() { - this.internalStorage = Collections.synchronizedMap(Maps.newHashMap()); + this.internalStorage = Collections.synchronizedMap(new HashMap<>()); } /** diff --git a/test-common/src/main/java/org/opendaylight/transportpce/test/DeviceWrapper.java b/test-common/src/main/java/org/opendaylight/transportpce/test/DeviceWrapper.java index 2c07cad3a..fa1fd7c32 100644 --- a/test-common/src/main/java/org/opendaylight/transportpce/test/DeviceWrapper.java +++ b/test-common/src/main/java/org/opendaylight/transportpce/test/DeviceWrapper.java @@ -7,6 +7,8 @@ */ package org.opendaylight.transportpce.test; +import static java.util.Objects.requireNonNull; + import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.Lists; @@ -71,7 +73,7 @@ public final class DeviceWrapper { * * @return the domDataBroker */ - public DOMDataBroker getDomDataBroker() { + public DOMDataBroker getDeviceDomDataBroker() { return domDataBroker; } @@ -95,8 +97,8 @@ public final class DeviceWrapper { */ public static DeviceWrapper createDeviceWrapper(@Nonnull String key, @Nonnull InputStream initialDataXmlInputStream, @Nonnull QName intialDataQName) { - Preconditions.checkNotNull(initialDataXmlInputStream, "Input stream cannot be null"); - Preconditions.checkNotNull(intialDataQName, "QName cannot be null"); + requireNonNull(initialDataXmlInputStream, "Input stream cannot be null"); + requireNonNull(intialDataQName, "QName cannot be null"); return createDeviceWrapper(key, Lists.newArrayList( new AbstractMap.SimpleEntry(intialDataQName, initialDataXmlInputStream))); } @@ -143,7 +145,7 @@ public final class DeviceWrapper { try { writeOnlyTransaction.commit().get(); } catch (InterruptedException | ExecutionException e) { - LOG.error("This should be not reached {}", e.getMessage(), e); + LOG.error("This should be not reached ", e); throw new IllegalStateException(e); } } -- 2.36.6