From ee993d85323419fb779a8edbef4350947c4d076a Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Tue, 10 Apr 2018 07:10:53 +0200 Subject: Fix various Sonar warnings Change-Id: I0883042a80525b72f33e66fdb0d5b9e600dcc713 Signed-off-by: Marek Gradzki --- .../java/io/fd/honeycomb/data/impl/ModificationDiff.java | 4 ++-- .../infra/distro/data/ShutdownHandlerProvider.java | 2 +- .../netconf/NetconfNotificationMapperProvider.java | 4 +--- .../northbound/restconf/HttpsConnectorProvider.java | 4 ++-- .../honeycomb/test/tools/YangDataProcessorRegistry.java | 15 +++++++-------- .../translate/impl/write/registry/FlatWriterRegistry.java | 2 +- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java index 98950b243..210408e39 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java @@ -146,12 +146,12 @@ final class ModificationDiff { final AbstractImmutableDataContainerNode parentContainerNode = (AbstractImmutableDataContainerNode) parentData; - final Map updates = + final Map childUpdates = parentContainerNode.getChildren().entrySet().stream() .flatMap(entry -> registry.normalizedUpdates(modification.getId(), entry).stream()) .collect(Collectors.toMap(NormalizedNodeUpdate::getId, update -> update)); - return new ModificationDiff(updates); + return new ModificationDiff(childUpdates); } } return EMPTY_DIFF; diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ShutdownHandlerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ShutdownHandlerProvider.java index 0c649b0da..a062ad1b2 100644 --- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ShutdownHandlerProvider.java +++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ShutdownHandlerProvider.java @@ -25,7 +25,7 @@ public class ShutdownHandlerProvider extends ProviderTrait { protected ShutdownHandler create() { final ShutdownHandler handler = new ShutdownHandlerImpl(); // Make sure ShutdownHandler is run on JVM shutdown - Runtime.getRuntime().addShutdownHook(new Thread((handler::performShutdown))); + Runtime.getRuntime().addShutdownHook(new Thread(handler::performShutdown)); return handler; } } diff --git a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfNotificationMapperProvider.java b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfNotificationMapperProvider.java index e402f046d..49e94bbb4 100644 --- a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfNotificationMapperProvider.java +++ b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfNotificationMapperProvider.java @@ -23,7 +23,6 @@ import io.fd.honeycomb.data.init.ShutdownHandler; import org.opendaylight.controller.config.yang.netconf.mdsal.notification.CapabilityChangeNotificationProducer; import org.opendaylight.controller.config.yang.netconf.mdsal.notification.NotificationToMdsalWriter; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory; import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener; @@ -65,8 +64,7 @@ public class NetconfNotificationMapperProvider extends ProviderTrait publisher = - new CapabilityChangeNotificationProducer(notificationCollector, dataBroker); + new CapabilityChangeNotificationProducer(notificationCollector, dataBroker); LOG.trace("Providing NetconfNotificationOperationServiceFactory"); NetconfNotificationOperationServiceFactory netconfNotificationOperationServiceFactory = diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/HttpsConnectorProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/HttpsConnectorProvider.java index 5a27bcb8e..b88819285 100644 --- a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/HttpsConnectorProvider.java +++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/HttpsConnectorProvider.java @@ -59,10 +59,10 @@ final class HttpsConnectorProvider extends ProviderTrait { URL keystoreURL = getClass().getResource(cfg.restconfKeystore.get()); sslContextFactory.setKeyStorePath(keystoreURL.getPath()); sslContextFactory.setKeyStorePassword(cfg.keystorePassword.get()); - sslContextFactory.setKeyManagerPassword((cfg.keystoreManagerPassword.get())); + sslContextFactory.setKeyManagerPassword(cfg.keystoreManagerPassword.get()); URL truststoreURL = getClass().getResource(cfg.restconfTruststore.get()); sslContextFactory.setTrustStorePath(truststoreURL.getPath()); - sslContextFactory.setTrustStorePassword((cfg.truststorePassword.get())); + sslContextFactory.setTrustStorePassword(cfg.truststorePassword.get()); // TODO HONEYCOMB-167 make this more configurable sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA", "SSL_DHE_RSA_WITH_DES_CBC_SHA", "SSL_DHE_DSS_WITH_DES_CBC_SHA", "SSL_RSA_EXPORT_WITH_RC4_40_MD5", diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java index d23cd59c1..b5057a527 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java @@ -16,17 +16,16 @@ package io.fd.honeycomb.test.tools; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import static com.google.common.base.Preconditions.checkState; -import javax.annotation.Nonnull; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkState; +import javax.annotation.Nonnull; +import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** * Process yang data from json to BA Objects @@ -56,7 +55,7 @@ final class YangDataProcessorRegistry { private YangDataProcessor pickProcessor(final YangInstanceIdentifier yangInstanceIdentifier) { final List eligibleProcessors = processors.stream() - .filter(processors -> processors.canProcess(yangInstanceIdentifier)) + .filter(processor -> processor.canProcess(yangInstanceIdentifier)) .collect(Collectors.toList()); // canProcess should be exclusive for node type, but just in case diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java index d8936850c..35f1c90a1 100644 --- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java +++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java @@ -202,7 +202,7 @@ final class FlatWriterRegistry implements WriterRegistry { if (writersData.isEmpty()) { // If there are no data for current writer, but it is a SubtreeWriter and there are updates to // its children, still invoke it with its root data - if (writer instanceof SubtreeWriter && isAffected(((SubtreeWriter) writer), updates)) { + if (writer instanceof SubtreeWriter && isAffected((SubtreeWriter) writer, updates)) { // Provide parent data for SubtreeWriter for further processing writersData = getParentDataObjectUpdate(ctx, updates, writer); } else { -- cgit 1.2.3-korg