From: Jakub Morvay Date: Tue, 21 Aug 2018 09:15:07 +0000 (+0000) Subject: Merge "NETCONF-557: Add support for URL capability" X-Git-Tag: release/neon~144 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=455dd29862158b2c1bfab4235860e8acec638065;hp=3379e3cc37adc81a91e1be0ea89c7b0464dc7b6a;p=netconf.git Merge "NETCONF-557: Add support for URL capability" --- diff --git a/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/CredentialServiceAuthProvider.java b/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/CredentialServiceAuthProvider.java index d6e1c95b4f..5f7bc777d6 100644 --- a/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/CredentialServiceAuthProvider.java +++ b/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/CredentialServiceAuthProvider.java @@ -41,7 +41,7 @@ public final class CredentialServiceAuthProvider implements AuthProvider { try { claim = credService.authenticate(new PasswordCredentialsWrapper(username, password)); } catch (AuthenticationException e) { - LOG.debug("Authentication failed for user '{}' : {}", username, e); + LOG.debug("Authentication failed for user '{}'", username, e); return false; } diff --git a/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallhomeStatusReporter.java b/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallhomeStatusReporter.java index 8a4979502b..3db60e9fca 100644 --- a/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallhomeStatusReporter.java +++ b/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallhomeStatusReporter.java @@ -304,7 +304,7 @@ class CallhomeStatusReporter implements DataTreeChangeListener, StatusReco return; } } catch (GeneralSecurityException e) { - LOG.error("Failed decoding a device key with host key: {} {}", keyString, e); + LOG.error("Failed decoding a device key with host key: {}", keyString, e); return; } } diff --git a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/EditConfig.java b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/EditConfig.java index 190c8bf1e9..28f8857aae 100644 --- a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/EditConfig.java +++ b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/EditConfig.java @@ -119,7 +119,7 @@ public final class EditConfig extends AbstractEdit { mergeParentMixin(rwtx, path, changeData); rwtx.put(LogicalDatastoreType.CONFIGURATION, path, changeData); } catch (final InterruptedException | ExecutionException e) { - LOG.warn("Read from datastore failed when trying to read data for create operation", change, e); + LOG.warn("Read from datastore failed when trying to read data for create operation {}", change, e); } break; case REPLACE: @@ -136,7 +136,7 @@ public final class EditConfig extends AbstractEdit { } rwtx.delete(LogicalDatastoreType.CONFIGURATION, path); } catch (final InterruptedException | ExecutionException e) { - LOG.warn("Read from datastore failed when trying to read data for delete operation", change, e); + LOG.warn("Read from datastore failed when trying to read data for delete operation {}", change, e); } break; case REMOVE: diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java index c5fad3f5b0..ea447e5117 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java @@ -83,9 +83,9 @@ public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNo try { tx.commit().get(); - LOG.debug("Stream %s registered successfully.", stream.getName()); + LOG.debug("Stream {} registered successfully.", stream.getName()); } catch (InterruptedException | ExecutionException e) { - LOG.warn("Unable to register stream.", e); + LOG.warn("Unable to register stream {}.", stream, e); } } @@ -99,9 +99,9 @@ public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNo try { tx.commit().get(); - LOG.debug("Stream %s unregistered successfully.", stream); + LOG.debug("Stream {} unregistered successfully.", stream); } catch (InterruptedException | ExecutionException e) { - LOG.warn("Unable to unregister stream", e); + LOG.warn("Unable to unregister stream {}", stream, e); } } } diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfOperationRouterImpl.java b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfOperationRouterImpl.java index 449b0db530..65a96e7583 100644 --- a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfOperationRouterImpl.java +++ b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfOperationRouterImpl.java @@ -79,13 +79,13 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter { tag, DocumentedException.ErrorSeverity.ERROR, Collections.singletonMap(tag.toString(), e.getMessage())); } catch (final RuntimeException e) { - throw handleUnexpectedEx("Unexpected exception during netconf operation sort", e); + throw handleUnexpectedEx("sort", e); } try { return executeOperationWithHighestPriority(message, netconfOperationExecution); } catch (final RuntimeException e) { - throw handleUnexpectedEx("Unexpected exception during netconf operation execution", e); + throw handleUnexpectedEx("execution", e); } } @@ -94,8 +94,8 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter { netconfOperationServiceSnapshot.close(); } - private static DocumentedException handleUnexpectedEx(final String message, final Exception exception) { - LOG.error("{}", message, exception); + private static DocumentedException handleUnexpectedEx(final String op, final Exception exception) { + LOG.error("Unexpected exception during netconf operation {}", op, exception); return new DocumentedException("Unexpected error", DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED, diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregator.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregator.java index 144b4f5b4c..74bf492292 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregator.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregator.java @@ -21,6 +21,8 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { private static final Logger LOG = LoggerFactory.getLogger(NetconfChunkAggregator.class); private static final String GOT_PARAM_WHILE_WAITING_FOR_PARAM = "Got byte {} while waiting for {}"; private static final String GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM = "Got byte {} while waiting for {}-{}"; + private static final String GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM_PARAM = + "Got byte {} while waiting for {}-{}-{}"; public static final int DEFAULT_MAXIMUM_CHUNK_SIZE = 16 * 1024 * 1024; private enum State { @@ -66,30 +68,26 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { final ByteBuf in, final List out) throws IllegalStateException { while (in.isReadable()) { switch (state) { - case HEADER_ONE: - { + case HEADER_ONE: { final byte b = in.readByte(); checkNewLine(b, "Malformed chunk header encountered (byte 0)"); state = State.HEADER_TWO; initChunk(); break; } - case HEADER_TWO: - { + case HEADER_TWO: { final byte b = in.readByte(); checkHash(b, "Malformed chunk header encountered (byte 1)"); state = State.HEADER_LENGTH_FIRST; break; } - case HEADER_LENGTH_FIRST: - { + case HEADER_LENGTH_FIRST: { final byte b = in.readByte(); chunkSize = processHeaderLengthFirst(b); state = State.HEADER_LENGTH_OTHER; break; } - case HEADER_LENGTH_OTHER: - { + case HEADER_LENGTH_OTHER: { final byte b = in.readByte(); if (b == '\n') { state = State.DATA; @@ -119,31 +117,27 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { aggregateChunks(in.readBytes((int) chunkSize)); state = State.FOOTER_ONE; break; - case FOOTER_ONE: - { + case FOOTER_ONE: { final byte b = in.readByte(); checkNewLine(b,"Malformed chunk footer encountered (byte 0)"); state = State.FOOTER_TWO; chunkSize = 0; break; } - case FOOTER_TWO: - { + case FOOTER_TWO: { final byte b = in.readByte(); checkHash(b,"Malformed chunk footer encountered (byte 1)"); state = State.FOOTER_THREE; break; } - case FOOTER_THREE: - { + case FOOTER_THREE: { final byte b = in.readByte(); // In this state, either header-of-new-chunk or message-end is expected // Depends on the next character extractNewChunkOrMessageEnd(b); break; } - case FOOTER_FOUR: - { + case FOOTER_FOUR: { final byte b = in.readByte(); checkNewLine(b,"Malformed chunk footer encountered (byte 3)"); state = State.HEADER_ONE; @@ -151,10 +145,8 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { chunk = null; break; } - default : - { + default: LOG.info("Unknown state."); - } } } @@ -170,7 +162,7 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { } else if (byteToCheck == '#') { state = State.FOOTER_FOUR; } else { - LOG.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM, byteToCheck, (byte) '#', (byte) '1', (byte) '9'); + LOG.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM_PARAM, byteToCheck, (byte) '#', (byte) '1', (byte) '9'); throw new IllegalStateException("Malformed chunk footer encountered (byte 2)"); } } diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java index b0d9cf75ba..3e0983812e 100644 --- a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java +++ b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java @@ -142,7 +142,7 @@ public class CreateSubscription extends AbstractSingletonNetconfOperation currentSession.sendMessage(new NetconfNotification(filtered.get(), eventTime)); } } catch (DocumentedException e) { - LOG.warn(e.toString()); + LOG.warn("Failed to process notification {}", notification, e); currentSession.sendMessage(notification); } } else { diff --git a/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/SshProxyClientHandler.java b/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/SshProxyClientHandler.java index edd63653f1..49f8b85242 100644 --- a/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/SshProxyClientHandler.java +++ b/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/SshProxyClientHandler.java @@ -85,12 +85,10 @@ final class SshProxyClientHandler extends ChannelInboundHandlerAdapter { @Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { - LOG.debug("Internal connection to netconf server was dropped for client: {} on channel: ", + LOG.debug("Internal connection to netconf server was dropped for client: {} on channel: {}", netconfHelloMessageAdditionalHeader.getAddress(), ctx.channel()); callback.onExit(1, "Internal connection to netconf server was dropped for client: " + netconfHelloMessageAdditionalHeader.getAddress() + " on channel: " + ctx.channel()); super.channelInactive(ctx); } - - } diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java index b6e56fbef4..17ea6cf243 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyDOMRpcService.java @@ -43,7 +43,7 @@ import scala.concurrent.Future; public class ProxyDOMRpcService implements DOMRpcService { - private static final Logger LOG = LoggerFactory.getLogger(NetconfTopologyManager.class); + private static final Logger LOG = LoggerFactory.getLogger(ProxyDOMRpcService.class); private final ExceptionMapper domRpcExceptionMapper = new ExceptionMapper("invokeRpc", DOMRpcException.class) { diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java index 68366c115c..a9acbe0c04 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java @@ -127,7 +127,7 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector { @Override public void onFailure(@Nullable final Throwable throwable) { - LOG.error("{}: Connector failed, {}", remoteDeviceId, throwable); + LOG.error("{}: Connector failed", remoteDeviceId, throwable); } }, MoreExecutors.directExecutor()); } diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/FailedProxyTransactionFacade.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/FailedProxyTransactionFacade.java index 97d51cb730..21e9a096f9 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/FailedProxyTransactionFacade.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/FailedProxyTransactionFacade.java @@ -35,7 +35,7 @@ class FailedProxyTransactionFacade implements ProxyTransactionFacade { private final RemoteDeviceId id; private final Throwable failure; - FailedProxyTransactionFacade(RemoteDeviceId id, Throwable failure) { + FailedProxyTransactionFacade(final RemoteDeviceId id, final Throwable failure) { this.id = Objects.requireNonNull(id); this.failure = Objects.requireNonNull(failure); } @@ -51,38 +51,41 @@ class FailedProxyTransactionFacade implements ProxyTransactionFacade { } @Override - public CheckedFuture>, ReadFailedException> read(LogicalDatastoreType store, - YangInstanceIdentifier path) { - LOG.debug("{}: Read {} {} - failure {}", id, store, path, failure); + public CheckedFuture>, ReadFailedException> read(final LogicalDatastoreType store, + final YangInstanceIdentifier path) { + LOG.debug("{}: Read {} {} - failure", id, store, path, failure); return Futures.immediateFailedCheckedFuture(ReadFailedException.MAPPER.apply( failure instanceof Exception ? (Exception)failure : new ReadFailedException("read", failure))); } @Override - public CheckedFuture exists(LogicalDatastoreType store, YangInstanceIdentifier path) { - LOG.debug("{}: Exists {} {} - failure {}", id, store, path, failure); + public CheckedFuture exists(final LogicalDatastoreType store, + final YangInstanceIdentifier path) { + LOG.debug("{}: Exists {} {} - failure", id, store, path, failure); return Futures.immediateFailedCheckedFuture(ReadFailedException.MAPPER.apply( failure instanceof Exception ? (Exception)failure : new ReadFailedException("read", failure))); } @Override - public void delete(LogicalDatastoreType store, YangInstanceIdentifier path) { - LOG.debug("{}: Delete {} {} - failure {}", id, store, path, failure); + public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) { + LOG.debug("{}: Delete {} {} - failure", id, store, path, failure); } @Override - public void put(LogicalDatastoreType store, YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("{}: Put {} {} - failure {}", id, store, path, failure); + public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, + final NormalizedNode data) { + LOG.debug("{}: Put {} {} - failure", id, store, path, failure); } @Override - public void merge(LogicalDatastoreType store, YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("{}: Merge {} {} - failure {}", id, store, path, failure); + public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, + final NormalizedNode data) { + LOG.debug("{}: Merge {} {} - failure", id, store, path, failure); } @Override public @NonNull FluentFuture commit() { - LOG.debug("{}: Commit {} {} - failure {}", id, failure); + LOG.debug("{}: Commit - failure", id, failure); return FluentFuture.from(Futures.immediateFailedFuture(failure instanceof Exception ? AsyncWriteTransaction.SUBMIT_EXCEPTION_MAPPER.apply((Exception)failure) : new TransactionCommitFailedException("commit", failure))); diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/utils/NetconfTopologyUtils.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/utils/NetconfTopologyUtils.java index a7eb35de68..4f70d88a7d 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/utils/NetconfTopologyUtils.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/utils/NetconfTopologyUtils.java @@ -46,7 +46,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class NetconfTopologyUtils { - private static Logger LOG = LoggerFactory.getLogger(NetconfTopologyUtils.class); + private static final Logger LOG = LoggerFactory.getLogger(NetconfTopologyUtils.class); private static final String DEFAULT_SCHEMA_REPOSITORY_NAME = "sal-netconf-connector"; diff --git a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java index a7ad10784f..c23046e86f 100644 --- a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java +++ b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/MountPointEndToEndTest.java @@ -44,6 +44,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.Map.Entry; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -623,7 +624,7 @@ public class MountPointEndToEndTest { private AbstractConcurrentDataBrokerTest newDataBrokerTest() throws Exception { AbstractConcurrentDataBrokerTest dataBrokerTest = new AbstractConcurrentDataBrokerTest(true) { @Override - protected Iterable getModuleInfos() throws Exception { + protected Set getModuleInfos() throws Exception { return ImmutableSet.of(BindingReflections.getModuleInfo(NetconfNode.class), BindingReflections.getModuleInfo(NetworkTopology.class), BindingReflections.getModuleInfo(Topology.class), diff --git a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java index d2c3638f69..2a5876ef6f 100644 --- a/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java +++ b/netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManagerTest.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Function; import javax.annotation.Nonnull; @@ -100,7 +101,7 @@ public class NetconfTopologyManagerTest { ConstantSchemaAbstractDataBrokerTest dataBrokerTest = new ConstantSchemaAbstractDataBrokerTest(false) { @Override - protected Iterable getModuleInfos() throws Exception { + protected Set getModuleInfos() throws Exception { return ImmutableSet.of(BindingReflections.getModuleInfo(NetworkTopology.class), BindingReflections.getModuleInfo(Topology.class)); } diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java index 818a3895dc..4bfdcd3c4c 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java @@ -290,12 +290,12 @@ public abstract class AbstractNetconfTopology implements NetconfTopology { Futures.addCallback(future, new FutureCallback() { @Override public void onSuccess(final NetconfDeviceCapabilities result) { - LOG.debug("Connector for : " + nodeId.getValue() + " started succesfully"); + LOG.debug("Connector for {} started succesfully", nodeId.getValue()); } @Override public void onFailure(final Throwable throwable) { - LOG.error("Connector for : " + nodeId.getValue() + " failed"); + LOG.error("Connector for {} failed", nodeId.getValue(), throwable); // remove this node from active connectors? } }, MoreExecutors.directExecutor()); @@ -303,8 +303,7 @@ public abstract class AbstractNetconfTopology implements NetconfTopology { return future; } - protected NetconfConnectorDTO createDeviceCommunicator(final NodeId nodeId, - final NetconfNode node) { + protected NetconfConnectorDTO createDeviceCommunicator(final NodeId nodeId, final NetconfNode node) { //setup default values since default value is not supported in mdsal final long defaultRequestTimeoutMillis = node.getDefaultRequestTimeoutMillis() == null ? DEFAULT_REQUEST_TIMEOUT_MILLIS : node.getDefaultRequestTimeoutMillis(); diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java index 781eb2aff1..996f7c91ca 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java @@ -90,7 +90,7 @@ public class NetconfConnectorFactoryImpl implements NetconfConnectorFactory { @Override public void onFailure(final Throwable throwable) { - LOG.error("Node {} creation failed: {}", instanceName, throwable); + LOG.error("Node {} creation failed", instanceName, throwable); } }, MoreExecutors.directExecutor()); return node; diff --git a/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/SendErrorExceptionUtil.java b/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/SendErrorExceptionUtil.java index f89d2848ef..1f09f55edc 100644 --- a/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/SendErrorExceptionUtil.java +++ b/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/SendErrorExceptionUtil.java @@ -31,14 +31,14 @@ public final class SendErrorExceptionUtil { public static void sendErrorMessage(final NetconfSession session, final DocumentedException sendErrorException) { - LOG.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException); + LOG.trace("Sending error", sendErrorException); final Document errorDocument = createDocument(sendErrorException); ChannelFuture channelFuture = session.sendMessage(new NetconfMessage(errorDocument)); channelFuture.addListener(new SendErrorVerifyingListener(sendErrorException)); } public static void sendErrorMessage(final Channel channel, final DocumentedException sendErrorException) { - LOG.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException); + LOG.trace("Sending error", sendErrorException); final Document errorDocument = createDocument(sendErrorException); ChannelFuture channelFuture = channel.writeAndFlush(new NetconfMessage(errorDocument)); channelFuture.addListener(new SendErrorVerifyingListener(sendErrorException)); diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java index 993b1230bd..633db8581b 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java @@ -172,7 +172,7 @@ public class NetconfDevice @Override public void onFailure(final Throwable throwable) { - LOG.warn("{}: Unexpected error resolving device sources: {}", id, throwable); + LOG.warn("{}: Unexpected error resolving device sources", id, throwable); handleSalInitializationFailure(throwable, listener); } }; diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfDeviceCommunicator.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfDeviceCommunicator.java index b962ae2075..df5e43e4c5 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfDeviceCommunicator.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfDeviceCommunicator.java @@ -345,8 +345,8 @@ public class NetconfDeviceCommunicator sessionLock.lock(); try { if (semaphore != null && !semaphore.tryAcquire()) { - LOG.warn("Limit of concurrent rpc messages was reached (limit :" + concurentRpcMsgs - + "). Rpc reply message is needed. Discarding request of Netconf device with id" + id.getName()); + LOG.warn("Limit of concurrent rpc messages was reached (limit: {}). Rpc reply message is needed. " + + "Discarding request of Netconf device with id {}", concurentRpcMsgs, id.getName()); return Futures.immediateFailedFuture(new NetconfDocumentedException( "Limit of rpc messages was reached (Limit :" + concurentRpcMsgs + ") waiting for emptying the queue of Netconf device with id" + id.getName())); diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalProvider.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalProvider.java index b215f882d2..ca84151ae9 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalProvider.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalProvider.java @@ -50,7 +50,7 @@ public class NetconfDeviceSalProvider implements AutoCloseable { @Override public void onTransactionChainSuccessful(final TransactionChain chain) { - LOG.trace("{}: TransactionChain({}) {} SUCCESSFUL", id, chain); + LOG.trace("{}: TransactionChain({}) SUCCESSFUL", id, chain); } }; @@ -123,7 +123,7 @@ public class NetconfDeviceSalProvider implements AutoCloseable { public synchronized void onTopologyDeviceConnected(final SchemaContext initialCtx, final DOMDataBroker broker, final DOMRpcService rpc, - final NetconfDeviceNotificationService newNotificationService, DOMActionService deviceAction) { + final NetconfDeviceNotificationService newNotificationService, final DOMActionService deviceAction) { Preconditions.checkNotNull(mountService, "Closed"); Preconditions.checkState(topologyRegistration == null, "Already initialized"); diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java index 5bc7903634..62e7341ca8 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java @@ -213,14 +213,14 @@ public class NetconfDeviceTopologyAdapter implements AutoCloseable { private void createNetworkTopologyIfNotPresent(final WriteTransaction writeTx) { final NetworkTopology networkTopology = new NetworkTopologyBuilder().build(); - LOG.trace("{}: Merging {} container to ensure its presence", id, - NetworkTopology.QNAME, writeTx.getIdentifier()); + LOG.trace("{}: Transaction {} merging {} container to ensure its presence", id, writeTx.getIdentifier(), + NetworkTopology.QNAME); writeTx.merge(LogicalDatastoreType.OPERATIONAL, networkTopologyPath, networkTopology); final Topology topology = new TopologyBuilder().setTopologyId(new TopologyId(TopologyNetconf.QNAME.getLocalName())).build(); - LOG.trace("{}: Merging {} container to ensure its presence", id, - Topology.QNAME, writeTx.getIdentifier()); + LOG.trace("{}: Transaction {} merging {} container to ensure its presence", id, writeTx.getIdentifier(), + Topology.QNAME); writeTx.merge(LogicalDatastoreType.OPERATIONAL, topologyListPath, topology); } diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/Execution.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/Execution.java index 9544559d0d..8a0595fde6 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/Execution.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/Execution.java @@ -5,8 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - - package org.opendaylight.netconf.test.tool; import com.ning.http.client.AsyncCompletionHandler; @@ -38,7 +36,7 @@ public class Execution implements Callable { private final String destination; private final String payload; - DestToPayload(String destination, String payload) { + DestToPayload(final String destination, final String payload) { this.destination = destination; this.payload = payload; } @@ -52,7 +50,7 @@ public class Execution implements Callable { } } - public Execution(TesttoolParameters params, ArrayList payloads) { + public Execution(final TesttoolParameters params, final ArrayList payloads) { this.invokeAsync = params.async; this.throttle = params.throttle / params.threadAmount; @@ -100,11 +98,11 @@ public class Execution implements Callable { } else { LOG.warn("Status code: {}", response.getStatusCode()); LOG.warn("url: {}", request.getUrl()); - LOG.warn(response.getResponseBody()); + LOG.warn("body: {}", response.getResponseBody()); } } } catch (InterruptedException | ExecutionException | IOException e) { - LOG.warn(e.toString()); + LOG.warn("Failed to execute request", e); } } LOG.info("End sending sync requests"); @@ -121,7 +119,7 @@ public class Execution implements Callable { } asyncHttpClient.executeRequest(request, new AsyncCompletionHandler() { @Override - public STATE onStatusReceived(HttpResponseStatus status) throws Exception { + public STATE onStatusReceived(final HttpResponseStatus status) throws Exception { super.onStatusReceived(status); if (status.getStatusCode() != 200 && status.getStatusCode() != 204) { if (status.getStatusCode() == 409) { @@ -137,7 +135,7 @@ public class Execution implements Callable { } @Override - public Response onCompleted(Response response) { + public Response onCompleted(final Response response) { semaphore.release(); return response; } diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java index f67c96e2f4..7d4d7e4cf1 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/ScaleUtil.java @@ -36,7 +36,7 @@ import org.opendaylight.netconf.test.tool.config.ConfigurationBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressFBWarnings({"DM_EXIT", "DM_DEFAULT_ENCODING"}) +@SuppressFBWarnings({"DM_EXIT", "DM_DEFAULT_ENCODING", "SLF4J_LOGGER_SHOULD_BE_FINAL"}) public final class ScaleUtil { private static final ScheduledExecutorService EXECUTOR = new LoggingWrapperExecutor(4); private static final Semaphore SEMAPHORE = new Semaphore(0); @@ -178,7 +178,7 @@ public final class ScaleUtil { deleteFolder(new File(params.distroFolder.getAbsoluteFile() + "/data")); } - private static void deleteFolder(File folder) { + private static void deleteFolder(final File folder) { File[] files = folder.listFiles(); if (files != null) { //some JVMs return null for empty dirs for (File f : files) { @@ -269,19 +269,19 @@ public final class ScaleUtil { @SuppressWarnings("checkstyle:illegalCatch") public static class LoggingWrapperExecutor extends ScheduledThreadPoolExecutor { - public LoggingWrapperExecutor(int corePoolSize) { + public LoggingWrapperExecutor(final int corePoolSize) { super(corePoolSize); } @Override - public ScheduledFuture schedule(Callable callable, long delay, TimeUnit unit) { + public ScheduledFuture schedule(final Callable callable, final long delay, final TimeUnit unit) { return super.schedule(new LogOnExceptionCallable<>(callable), delay, unit); } private static class LogOnExceptionCallable implements Callable { private final Callable theCallable; - LogOnExceptionCallable(Callable theCallable) { + LogOnExceptionCallable(final Callable theCallable) { this.theCallable = theCallable; } diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/http/perf/SyncExecutionStrategy.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/http/perf/SyncExecutionStrategy.java index d8d6002095..1aeb843f51 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/http/perf/SyncExecutionStrategy.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/http/perf/SyncExecutionStrategy.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.test.tool.client.http.perf; import com.ning.http.client.AsyncHttpClient; @@ -43,10 +42,10 @@ public class SyncExecutionStrategy implements ExecutionStrategy { if (response.getStatusCode() != 200 && response.getStatusCode() != 204) { LOG.warn("Status code: {}", response.getStatusCode()); LOG.warn("url: {}", request.getUrl()); - LOG.warn(response.getResponseBody()); + LOG.warn("body: {}", response.getResponseBody()); } } catch (InterruptedException | ExecutionException | IOException e) { - LOG.warn(e.toString()); + LOG.warn("Failed to execute request", e); } } LOG.info("End sending sync requests"); diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java index 763a7b8b67..6b51558546 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java @@ -117,12 +117,11 @@ public final class StressClient { root.setLevel(params.debug ? Level.DEBUG : Level.INFO); final int threadAmount = params.threadAmount; - LOG.info("thread amount: " + threadAmount); + LOG.info("thread amount: {}", threadAmount); final int requestsPerThread = params.editCount / params.threadAmount; - LOG.info("requestsPerThread: " + requestsPerThread); + LOG.info("requestsPerThread: {}", requestsPerThread); final int leftoverRequests = params.editCount % params.threadAmount; - LOG.info("leftoverRequests: " + leftoverRequests); - + LOG.info("leftoverRequests: {}", leftoverRequests); LOG.info("Preparing messages"); // Prepare all msgs up front @@ -150,7 +149,7 @@ public final class StressClient { padding = leftoverRequests; } for (int j = 0; j < requestsPerThread + padding; j++) { - LOG.debug("id: " + (i * requestsPerThread + j)); + LOG.debug("id: {}", i * requestsPerThread + j); preparedMessages.add(prepareMessage(i * requestsPerThread + j, editContentString)); } } diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/schemacache/SchemaSourceCache.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/schemacache/SchemaSourceCache.java index 9ac7b647c0..c038b6bc6b 100644 --- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/schemacache/SchemaSourceCache.java +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/schemacache/SchemaSourceCache.java @@ -76,13 +76,14 @@ public final class SchemaSourceCache @Override public synchronized ListenableFuture getSource(final SourceIdentifier sourceIdentifier) { - ModelData modelData = cachedSchemas.get(sourceIdentifier.toYangFilename()); + final String fileName = sourceIdentifier.toYangFilename(); + ModelData modelData = cachedSchemas.get(fileName); if (modelData != null) { final SchemaSourceRepresentation restored = restoreAsType(modelData.getId(), modelData.getPath()); return Futures.immediateFuture(representation.cast(restored)); } - LOG.debug("Source {} not found in cache as {}", sourceIdentifier); + LOG.debug("Source {} not found in cache as {}", sourceIdentifier, fileName); return Futures.immediateFailedFuture(new MissingSchemaSourceException("Source not found", sourceIdentifier)); } diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java index 49427f1a74..ffe11aed7a 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java @@ -100,16 +100,16 @@ public class BrokerFacade implements Closeable { private final DOMNotificationService domNotification; private final ControllerContext controllerContext; - private BrokerFacade(DOMRpcService rpcService, DOMDataBroker domDataBroker, DOMNotificationService domNotification, - ControllerContext controllerContext) { + private BrokerFacade(final DOMRpcService rpcService, final DOMDataBroker domDataBroker, + final DOMNotificationService domNotification, final ControllerContext controllerContext) { this.rpcService = Objects.requireNonNull(rpcService); this.domDataBroker = Objects.requireNonNull(domDataBroker); this.domNotification = Objects.requireNonNull(domNotification); this.controllerContext = Objects.requireNonNull(controllerContext); } - public static BrokerFacade newInstance(DOMRpcService rpcService, DOMDataBroker domDataBroker, - DOMNotificationService domNotification, ControllerContext controllerContext) { + public static BrokerFacade newInstance(final DOMRpcService rpcService, final DOMDataBroker domDataBroker, + final DOMNotificationService domNotification, final ControllerContext controllerContext) { return new BrokerFacade(rpcService, domDataBroker, domNotification, controllerContext); } @@ -176,9 +176,7 @@ public class BrokerFacade implements Closeable { return readDataViaTransaction(tx, CONFIGURATION, path, withDefa); } } - final String errMsg = "DOM data broker service isn't available for mount point " + path; - LOG.warn(errMsg); - throw new RestconfDocumentedException(errMsg); + throw dataBrokerUnavailable(path); } /** @@ -210,9 +208,7 @@ public class BrokerFacade implements Closeable { return readDataViaTransaction(tx, OPERATIONAL, path); } } - final String errMsg = "DOM data broker service isn't available for mount point " + path; - LOG.warn(errMsg); - throw new RestconfDocumentedException(errMsg); + throw dataBrokerUnavailable(path); } /** @@ -287,9 +283,7 @@ public class BrokerFacade implements Closeable { point); return new PutResult(status, future); } - final String errMsg = "DOM data broker service isn't available for mount point " + path; - LOG.warn(errMsg); - throw new RestconfDocumentedException(errMsg); + throw dataBrokerUnavailable(path); } public PatchStatusContext patchConfigurationDataWithinTransaction(final PatchContext patchContext) @@ -464,9 +458,7 @@ public class BrokerFacade implements Closeable { return postDataViaTransaction(domDataBrokerService.get().newReadWriteTransaction(), CONFIGURATION, path, payload, mountPoint.getSchemaContext(), insert, point); } - final String errMsg = "DOM data broker service isn't available for mount point " + path; - LOG.warn(errMsg); - throw new RestconfDocumentedException(errMsg); + throw dataBrokerUnavailable(path); } // DELETE configuration @@ -481,9 +473,7 @@ public class BrokerFacade implements Closeable { if (domDataBrokerService.isPresent()) { return deleteDataViaTransaction(domDataBrokerService.get().newReadWriteTransaction(), CONFIGURATION, path); } - final String errMsg = "DOM data broker service isn't available for mount point " + path; - LOG.warn(errMsg); - throw new RestconfDocumentedException(errMsg); + throw dataBrokerUnavailable(path); } // RPC @@ -948,8 +938,7 @@ public class BrokerFacade implements Closeable { private static void checkItemExists(final DOMDataReadWriteTransaction rwTransaction, final LogicalDatastoreType store, final YangInstanceIdentifier path) { if (!doesItemExist(rwTransaction, store, path)) { - final String errMsg = "Operation via Restconf was not executed because data does not exist"; - LOG.trace("{}:{}", errMsg, path); + LOG.trace("Operation via Restconf was not executed because data at {} does not exist", path); rwTransaction.cancel(); throw new RestconfDocumentedException("Data does not exist for path: " + path, ErrorType.PROTOCOL, ErrorTag.DATA_MISSING); @@ -965,8 +954,7 @@ public class BrokerFacade implements Closeable { private static void checkItemDoesNotExists(final DOMDataReadWriteTransaction rwTransaction, final LogicalDatastoreType store, final YangInstanceIdentifier path) { if (doesItemExist(rwTransaction, store, path)) { - final String errMsg = "Operation via Restconf was not executed because data already exists"; - LOG.trace("{}:{}", errMsg, path); + LOG.trace("Operation via Restconf was not executed because data at {} already exists", path); rwTransaction.cancel(); throw new RestconfDocumentedException("Data already exists for path: " + path, ErrorType.PROTOCOL, ErrorTag.DATA_EXISTS); @@ -1236,6 +1224,11 @@ public class BrokerFacade implements Closeable { tx.merge(store, rootNormalizedPath, parentStructure); } + private static RestconfDocumentedException dataBrokerUnavailable(final YangInstanceIdentifier path) { + LOG.warn("DOM data broker service is not available for mount point {}", path); + return new RestconfDocumentedException("DOM data broker service is not available for mount point " + path); + } + private static final class PatchStatusContextHelper { PatchStatusContext status; diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestCodec.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestCodec.java index 513060e7be..a3fc3c5b2d 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestCodec.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestCodec.java @@ -116,15 +116,12 @@ public final class RestCodec { } return typeAwarecodec.deserialize(String.valueOf(input)); } else { - LOG.debug("Codec for type \"" + this.type.getQName().getLocalName() - + "\" is not implemented yet."); + LOG.debug("Codec for type \"{}\" is not implemented yet.", type.getQName().getLocalName()); return null; } } } catch (final ClassCastException e) { // TODO remove this catch when everyone use codecs - LOG.error( - "ClassCastException was thrown when codec is invoked with parameter " + String.valueOf(input), - e); + LOG.error("ClassCastException was thrown when codec is invoked with parameter {}", input, e); return null; } } @@ -145,17 +142,12 @@ public final class RestCodec { if (typeAwarecodec != null) { return typeAwarecodec.serialize(input); } else { - if (LOG.isDebugEnabled()) { - LOG.debug("Codec for type \"" + this.type.getQName().getLocalName() - + "\" is not implemented yet."); - } + LOG.debug("Codec for type \"{}\" is not implemented yet.", type.getQName().getLocalName()); return null; } } } catch (final ClassCastException e) { // TODO remove this catch when everyone use codecs - LOG.error( - "ClassCastException was thrown when codec is invoked with parameter " + String.valueOf(input), - e); + LOG.error("ClassCastException was thrown when codec is invoked with parameter {}", input, e); return input; } } @@ -169,7 +161,7 @@ public final class RestCodec { private final DOMMountPoint mountPoint; private final ControllerContext controllerContext; - public IdentityrefCodecImpl(final DOMMountPoint mountPoint, ControllerContext controllerContext) { + public IdentityrefCodecImpl(final DOMMountPoint mountPoint, final ControllerContext controllerContext) { this.mountPoint = mountPoint; this.controllerContext = controllerContext; } @@ -350,7 +342,7 @@ public final class RestCodec { module = controllerContext.findModuleByNamespace(validNamespace); } if (module == null) { - LOG.info("Module for namespace " + validNamespace + " wasn't found."); + LOG.info("Module for namespace {} was not found.", validNamespace); return null; } return module; diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java index 60800413a4..d748ef32c0 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java @@ -175,12 +175,12 @@ public final class RestconfImpl implements RestconfService { private final ControllerContext controllerContext; - private RestconfImpl(BrokerFacade broker, ControllerContext controllerContext) { + private RestconfImpl(final BrokerFacade broker, final ControllerContext controllerContext) { this.broker = broker; this.controllerContext = controllerContext; } - public static RestconfImpl newInstance(BrokerFacade broker, ControllerContext controllerContext) { + public static RestconfImpl newInstance(final BrokerFacade broker, final ControllerContext controllerContext) { return new RestconfImpl(broker, controllerContext); } @@ -213,7 +213,7 @@ public final class RestconfImpl implements RestconfService { if (!identifier.contains(ControllerContext.MOUNT)) { final String errMsg = "URI has bad format. If modules behind mount point should be showed," + " URI has to end with " + ControllerContext.MOUNT; - LOG.debug(errMsg + " for " + identifier); + LOG.debug("{} for {}", errMsg, identifier); throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); } @@ -258,10 +258,9 @@ public final class RestconfImpl implements RestconfService { } if (module == null) { - final String errMsg = "Module with name '" + nameRev.getKey() + "' and revision '" - + nameRev.getValue() + "' was not found."; - LOG.debug(errMsg); - throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.UNKNOWN_ELEMENT); + LOG.debug("Module with name '{}' and revision '{}' was not found.", nameRev.getKey(), nameRev.getValue()); + throw new RestconfDocumentedException("Module with name '" + nameRev.getKey() + "' and revision '" + + nameRev.getValue() + "' was not found.", ErrorType.PROTOCOL, ErrorTag.UNKNOWN_ELEMENT); } final Module restconfModule = getRestconfModule(); @@ -323,11 +322,10 @@ public final class RestconfImpl implements RestconfService { modules = this.controllerContext.getAllModules(mountPoint); } else { - final String errMsg = - "URI has bad format. If operations behind mount point should be showed, URI has to " + "end with "; - LOG.debug(errMsg + ControllerContext.MOUNT + " for " + identifier); - throw new RestconfDocumentedException(errMsg + ControllerContext.MOUNT, ErrorType.PROTOCOL, - ErrorTag.INVALID_VALUE); + final String errMsg = "URI has bad format. If operations behind mount point should be showed, URI has to " + + " end with " + ControllerContext.MOUNT; + LOG.debug("{} for {}", errMsg, identifier); + throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); } return operationsFromModulesToNormalizedContext(modules, mountPoint); @@ -402,7 +400,7 @@ public final class RestconfImpl implements RestconfService { final Splitter splitter = Splitter.on('/').omitEmptyStrings(); final List pathArgs = splitter.splitToList(moduleNameAndRevision); if (pathArgs.size() < 2) { - LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' " + identifier); + LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' {}", identifier); throw new RestconfDocumentedException( "URI has bad format. End of URI should be in format \'moduleName/yyyy-MM-dd\'", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); @@ -411,7 +409,7 @@ public final class RestconfImpl implements RestconfService { try { return new SimpleImmutableEntry<>(pathArgs.get(0), Revision.of(pathArgs.get(1))); } catch (final DateTimeParseException e) { - LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' " + identifier); + LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' {}", identifier); throw new RestconfDocumentedException("URI has bad format. It should be \'moduleName/yyyy-MM-dd\'", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, e); } @@ -474,7 +472,7 @@ public final class RestconfImpl implements RestconfService { @Override public NormalizedNodeContext invokeRpc(final String identifier, final String noPayload, final UriInfo uriInfo) { - if (noPayload != null && !CharMatcher.WHITESPACE.matchesAllOf(noPayload)) { + if (noPayload != null && !CharMatcher.whitespace().matchesAllOf(noPayload)) { throw new RestconfDocumentedException("Content must be empty.", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); } @@ -491,13 +489,11 @@ public final class RestconfImpl implements RestconfService { final String remoteRpcName = identifier.substring(startOfRemoteRpcName); identifierEncoded = remoteRpcName; - } else if (identifier.indexOf("/") != CHAR_NOT_FOUND) { - final String slashErrorMsg = String.format( - "Identifier %n%s%ncan\'t contain slash " - + "character (/).%nIf slash is part of identifier name then use %%2F placeholder.", - identifier); - LOG.debug(slashErrorMsg); - throw new RestconfDocumentedException(slashErrorMsg, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); + } else if (identifier.indexOf('/') != CHAR_NOT_FOUND) { + LOG.debug("Identifier {} cannot contain slash character (/).", identifier); + throw new RestconfDocumentedException(String.format("Identifier %n%s%ncan\'t contain slash character (/).%n" + + "If slash is part of identifier name then use %%2F placeholder.", identifier), ErrorType.PROTOCOL, + ErrorTag.INVALID_VALUE); } else { identifierEncoded = identifier; schemaContext = this.controllerContext.getGlobalSchema(); @@ -513,12 +509,12 @@ public final class RestconfImpl implements RestconfService { } if (rpc == null) { - LOG.debug("RPC " + identifierDecoded + " does not exist."); + LOG.debug("RPC {} does not exist.", identifierDecoded); throw new RestconfDocumentedException("RPC does not exist.", ErrorType.RPC, ErrorTag.UNKNOWN_ELEMENT); } if (!rpc.getInput().getChildNodes().isEmpty()) { - LOG.debug("RPC " + rpc + " does not need input value."); + LOG.debug("RPC {} does not need input value.", rpc); throw new RestconfDocumentedException("RPC " + rpc + " does not take any input value.", ErrorType.RPC, ErrorTag.INVALID_VALUE); } @@ -550,11 +546,11 @@ public final class RestconfImpl implements RestconfService { if (retValue.getErrors().isEmpty()) { return retValue; } - LOG.debug("RpcError message", retValue.getErrors()); + LOG.debug("RpcError message {}", retValue.getErrors()); throw new RestconfDocumentedException("RpcError message", null, retValue.getErrors()); } catch (final InterruptedException e) { final String errMsg = "The operation was interrupted while executing and did not complete."; - LOG.debug("Rpc Interrupt - " + errMsg, e); + LOG.debug("Rpc Interrupt - {}", errMsg, e); throw new RestconfDocumentedException(errMsg, ErrorType.RPC, ErrorTag.PARTIAL_OPERATION, e); } catch (final ExecutionException e) { LOG.debug("Execution RpcError: ", e); @@ -579,7 +575,7 @@ public final class RestconfImpl implements RestconfService { } } catch (final CancellationException e) { final String errMsg = "The operation was cancelled while executing."; - LOG.debug("Cancel RpcExecution: " + errMsg, e); + LOG.debug("Cancel RpcExecution: {}", errMsg, e); throw new RestconfDocumentedException(errMsg, ErrorType.RPC, ErrorTag.PARTIAL_OPERATION); } } @@ -604,9 +600,9 @@ public final class RestconfImpl implements RestconfService { final Object pathValue = path.isPresent() ? path.get().getValue() : null; if (!(pathValue instanceof YangInstanceIdentifier)) { - final String errMsg = "Instance identifier was not normalized correctly "; - LOG.debug(errMsg + rpcQName); - throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED); + LOG.debug("Instance identifier {} was not normalized correctly", rpcQName); + throw new RestconfDocumentedException("Instance identifier was not normalized correctly", + ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED); } final YangInstanceIdentifier pathIdentifier = (YangInstanceIdentifier) pathValue; @@ -631,9 +627,10 @@ public final class RestconfImpl implements RestconfService { } if (Strings.isNullOrEmpty(streamName)) { - final String errMsg = "Path is empty or contains value node which is not Container or List build-in type."; - LOG.debug(errMsg + pathIdentifier); - throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); + LOG.debug("Path is empty or contains value node which is not Container or List built-in type at {}", + pathIdentifier); + throw new RestconfDocumentedException("Path is empty or contains value node which is not Container or List " + + "built-in type.", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); } final QName outputQname = QName.create(rpcQName, "output"); @@ -655,9 +652,9 @@ public final class RestconfImpl implements RestconfService { private static RpcDefinition findRpc(final SchemaContext schemaContext, final String identifierDecoded) { final String[] splittedIdentifier = identifierDecoded.split(":"); if (splittedIdentifier.length != 2) { - final String errMsg = identifierDecoded + " couldn't be splitted to 2 parts (module:rpc name)"; - LOG.debug(errMsg); - throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.INVALID_VALUE); + LOG.debug("{} could not be split to 2 parts (module:rpc name)", identifierDecoded); + throw new RestconfDocumentedException(identifierDecoded + " could not be split to 2 parts " + + "(module:rpc name)", ErrorType.APPLICATION, ErrorTag.INVALID_VALUE); } for (final Module module : schemaContext.getModules()) { if (module.getName().equals(splittedIdentifier[0])) { @@ -712,10 +709,7 @@ public final class RestconfImpl implements RestconfService { data = this.broker.readConfigurationData(normalizedII, withDefa); } if (data == null) { - final String errMsg = - "Request could not be completed because the relevant data model content does not exist "; - LOG.debug(errMsg + identifier); - throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.DATA_MISSING); + throw dataMissing(identifier); } return new NormalizedNodeContext(iiWithData, data, QueryParametersParser.parseWriterParameters(uriInfo, tagged)); @@ -733,14 +727,18 @@ public final class RestconfImpl implements RestconfService { data = this.broker.readOperationalData(normalizedII); } if (data == null) { - final String errMsg = - "Request could not be completed because the relevant data model content does not exist "; - LOG.debug(errMsg + identifier); - throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.DATA_MISSING); + throw dataMissing(identifier); } return new NormalizedNodeContext(iiWithData, data, QueryParametersParser.parseWriterParameters(uriInfo)); } + private static RestconfDocumentedException dataMissing(final String identifier) { + LOG.debug("Request could not be completed because the relevant data model content does not exist {}", + identifier); + return new RestconfDocumentedException("Request could not be completed because the relevant data model content " + + "does not exist", ErrorType.APPLICATION, ErrorTag.DATA_MISSING); + } + @Override public Response updateConfigurationData(final String identifier, final NormalizedNodeContext payload, final UriInfo uriInfo) { @@ -825,13 +823,13 @@ public final class RestconfImpl implements RestconfService { } catch (final TransactionCommitFailedException e) { if (e instanceof OptimisticLockFailedException) { if (--tries <= 0) { - LOG.debug("Got OptimisticLockFailedException on last try - failing " + identifier); + LOG.debug("Got OptimisticLockFailedException on last try - failing {}", identifier); throw new RestconfDocumentedException(e.getMessage(), e, e.getErrorList()); } - LOG.debug("Got OptimisticLockFailedException - trying again " + identifier); + LOG.debug("Got OptimisticLockFailedException - trying again {}", identifier); } else { - LOG.debug("Update failed for " + identifier, e); + LOG.debug("Update failed for {}", identifier, e); throw new RestconfDocumentedException(e.getMessage(), e, e.getErrorList()); } } @@ -974,7 +972,7 @@ public final class RestconfImpl implements RestconfService { } catch (final RestconfDocumentedException e) { throw e; } catch (final TransactionCommitFailedException e) { - LOG.info("Error creating data " + (uriInfo != null ? uriInfo.getPath() : ""), e); + LOG.info("Error creating data {}", uriInfo != null ? uriInfo.getPath() : "", e); throw new RestconfDocumentedException(e.getMessage(), e, e.getErrorList()); } @@ -1002,7 +1000,7 @@ public final class RestconfImpl implements RestconfService { try { uriBuilder.path(this.controllerContext.toFullRestconfIdentifier(normalizedII, mountPoint)); } catch (final Exception e) { - LOG.info("Location for instance identifier" + normalizedII + "wasn't created", e); + LOG.info("Location for instance identifier {} was not created", normalizedII, e); return null; } return uriBuilder.build(); @@ -1207,7 +1205,7 @@ public final class RestconfImpl implements RestconfService { return uriToWebsocketServerBuilder.replacePath(streamName).build(); } - private String getWsScheme(UriInfo uriInfo) { + private String getWsScheme(final UriInfo uriInfo) { URI uri = uriInfo.getAbsolutePath(); if (uri == null) { return "ws"; diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/AbstractCommonSubscriber.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/AbstractCommonSubscriber.java index 877deda59f..41503253bc 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/AbstractCommonSubscriber.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/AbstractCommonSubscriber.java @@ -65,7 +65,7 @@ abstract class AbstractCommonSubscriber extends AbstractQueryParams implements B */ public void addSubscriber(final Channel subscriber) { if (!subscriber.isActive()) { - LOG.debug("Channel is not active between websocket server and subscriber {}" + subscriber.remoteAddress()); + LOG.debug("Channel is not active between websocket server and subscriber {}", subscriber.remoteAddress()); } final Event event = new Event(EventType.REGISTER); event.setSubscriber(subscriber); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/codecs/RestCodec.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/codecs/RestCodec.java index fc55698a99..f4e1f841e1 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/codecs/RestCodec.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/codecs/RestCodec.java @@ -103,7 +103,7 @@ public final class RestCodec { if (LOG.isDebugEnabled()) { LOG.debug( "Value is not instance of IdentityrefTypeDefinition but is {}. " - + "Therefore NULL is used as translation of - {}", + + "Therefore NULL is used as translation of - {}", input == null ? "null" : input.getClass(), String.valueOf(input)); } return null; @@ -124,15 +124,12 @@ public final class RestCodec { } return typeAwarecodec.deserialize(String.valueOf(input)); } else { - LOG.debug("Codec for type \"" + this.type.getQName().getLocalName() - + "\" is not implemented yet."); + LOG.debug("Codec for type \"{}\" is not implemented yet.", type.getQName().getLocalName()); return null; } } } catch (final ClassCastException e) { // TODO remove this catch when everyone use codecs - LOG.error( - "ClassCastException was thrown when codec is invoked with parameter " + String.valueOf(input), - e); + LOG.error("ClassCastException was thrown when codec is invoked with parameter {}", input, e); return null; } } @@ -154,20 +151,16 @@ public final class RestCodec { return typeAwarecodec.serialize(input); } else { if (LOG.isDebugEnabled()) { - LOG.debug("Codec for type \"" + this.type.getQName().getLocalName() - + "\" is not implemented yet."); + LOG.debug("Codec for type \"{}\" is not implemented yet.", type.getQName().getLocalName()); } return null; } } } catch (final ClassCastException e) { // TODO remove this catch when everyone use codecs - LOG.error( - "ClassCastException was thrown when codec is invoked with parameter " + String.valueOf(input), - e); + LOG.error("ClassCastException was thrown when codec is invoked with parameter {}", input, e); return input; } } - } public static class IdentityrefCodecImpl implements IdentityrefCodec { @@ -355,7 +348,7 @@ public final class RestCodec { module = schemaContext.findModules(validNamespace).iterator().next(); } if (module == null) { - LOG.info("Module for namespace " + validNamespace + " wasn't found."); + LOG.info("Module for namespace {} was not found.", validNamespace); return null; } return module; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/TransactionChainHandler.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/TransactionChainHandler.java index 81cdb08d96..4acea3aad7 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/TransactionChainHandler.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/TransactionChainHandler.java @@ -38,7 +38,7 @@ public class TransactionChainHandler implements Handler, Au @Override public void onTransactionChainSuccessful(final TransactionChain chain) { - LOG.trace("TransactionChain({}) {} SUCCESSFUL", chain); + LOG.trace("TransactionChain({}) SUCCESSFUL", chain); } }; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java index 3e31ea6d5f..bcb93603d5 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java @@ -228,7 +228,7 @@ public class JSONRestconfServiceRfc8040Impl implements JSONRestconfService, Auto return JsonNormalizedNodeBodyReader.readFrom(instanceIdentifierContext, entityStream, isPost); } - private String toJson(final PatchStatusContext patchStatusContext) throws IOException { + private static String toJson(final PatchStatusContext patchStatusContext) throws IOException { final PatchJsonBodyWriter writer = new PatchJsonBodyWriter(); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); writer.writeTo(patchStatusContext, PatchStatusContext.class, null, EMPTY_ANNOTATIONS, diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/CreateStreamUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/CreateStreamUtil.java index 8732c8f002..e088077d23 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/CreateStreamUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/CreateStreamUtil.java @@ -179,9 +179,9 @@ public final class CreateStreamUtil { pathValue = path.get().getValue(); } if (!(pathValue instanceof YangInstanceIdentifier)) { - final String errMsg = "Instance identifier was not normalized correctly "; - LOG.debug(errMsg + qualifiedName); - throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED); + LOG.debug("Instance identifier {} was not normalized correctly", qualifiedName); + throw new RestconfDocumentedException("Instance identifier was not normalized correctly", + ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED); } return (YangInstanceIdentifier) pathValue; } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java index 7781c71140..2a843ce903 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java @@ -281,10 +281,9 @@ public final class PatchDataTransactionUtil { FutureCallbackTx.addCallback(future, PatchData.PATCH_TX_TYPE, response); if (!response.result) { - final String errMsg = "Operation via Restconf was not executed because data does not exist"; - LOG.trace("{}:{}", errMsg, path); - throw new RestconfDocumentedException( - "Data does not exist", ErrorType.PROTOCOL, ErrorTag.DATA_MISSING, path); + LOG.trace("Operation via Restconf was not executed because data at {} does not exist", path); + throw new RestconfDocumentedException("Data does not exist", ErrorType.PROTOCOL, ErrorTag.DATA_MISSING, + path); } } @@ -303,10 +302,9 @@ public final class PatchDataTransactionUtil { FutureCallbackTx.addCallback(future, PatchData.PATCH_TX_TYPE, response); if (response.result) { - final String errMsg = "Operation via Restconf was not executed because data already exists"; - LOG.trace("{}:{}", errMsg, path); - throw new RestconfDocumentedException( - "Data already exists", ErrorType.PROTOCOL, ErrorTag.DATA_EXISTS, path); + LOG.trace("Operation via Restconf was not executed because data at {} already exists", path); + throw new RestconfDocumentedException("Data already exists", ErrorType.PROTOCOL, ErrorTag.DATA_EXISTS, + path); } } } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java index b5d44cd5ac..1f023c4ca7 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java @@ -97,11 +97,11 @@ public final class RestconfInvokeOperationsUtil { if (response.getErrors().isEmpty()) { return response; } - LOG.debug("RpcError message", response.getErrors()); + LOG.debug("RpcError message {}", response.getErrors()); throw new RestconfDocumentedException("RPCerror message ", null, response.getErrors()); } catch (final CancellationException e) { final String errMsg = "The operation was cancelled while executing."; - LOG.debug("Cancel RpcExecution: " + errMsg, e); + LOG.debug("Cancel RpcExecution: {}", errMsg, e); throw new RestconfDocumentedException(errMsg, ErrorType.RPC, ErrorTag.PARTIAL_OPERATION, e); } } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/TransactionUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/TransactionUtil.java index f6e50c021a..50d61dec77 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/TransactionUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/TransactionUtil.java @@ -104,8 +104,7 @@ public final class TransactionUtil { transactionChainHandler.reset(); // throw error - final String errMsg = "Operation via Restconf was not executed because data does not exist"; - LOG.trace("{}:{}", errMsg, path); + LOG.trace("Operation via Restconf was not executed because data at {} does not exist", path); throw new RestconfDocumentedException( "Data does not exist", ErrorType.PROTOCOL, ErrorTag.DATA_MISSING, path); } @@ -135,8 +134,7 @@ public final class TransactionUtil { transactionChainHandler.reset(); // throw error - final String errMsg = "Operation via Restconf was not executed because data already exists"; - LOG.trace("{}:{}", errMsg, path); + LOG.trace("Operation via Restconf was not executed because data at {} already exists", path); throw new RestconfDocumentedException( "Data already exists", ErrorType.PROTOCOL, ErrorTag.DATA_EXISTS, path); } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/services/simple/impl/RestconfOperationsServiceImpl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/services/simple/impl/RestconfOperationsServiceImpl.java index 51f1f3eccc..f25fc62f30 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/services/simple/impl/RestconfOperationsServiceImpl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/services/simple/impl/RestconfOperationsServiceImpl.java @@ -94,9 +94,9 @@ public class RestconfOperationsServiceImpl implements RestconfOperationsService mountPoint = mountPointIdentifier.getMountPoint(); modules = ref.getModules(mountPoint); } else { - final String errMsg = - "URI has bad format. If operations behind mount point should be showed, URI has to end with "; - LOG.debug(errMsg + RestconfConstants.MOUNT + " for " + identifier); + final String errMsg = "URI has bad format. If operations behind mount point should be showed, URI has to " + + " end with " + RestconfConstants.MOUNT; + LOG.debug("{} for {}", errMsg, identifier); throw new RestconfDocumentedException(errMsg + RestconfConstants.MOUNT, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractCommonSubscriber.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractCommonSubscriber.java index 6e2004eea4..ebf5da4a0d 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractCommonSubscriber.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractCommonSubscriber.java @@ -69,7 +69,7 @@ abstract class AbstractCommonSubscriber extends AbstractQueryParams implements B */ public void addSubscriber(final Channel subscriber) { if (!subscriber.isActive()) { - LOG.debug("Channel is not active between websocket server and subscriber {}" + subscriber.remoteAddress()); + LOG.debug("Channel is not active between websocket server and subscriber {}", subscriber.remoteAddress()); } final Event event = new Event(EventType.REGISTER); event.setSubscriber(subscriber); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java index b5438ff866..ee26e83723 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java @@ -156,7 +156,7 @@ public final class ParserIdentifier { // check if more than one slash is not used as path separator if (identifier.contains( String.valueOf(RestconfConstants.SLASH).concat(String.valueOf(RestconfConstants.SLASH)))) { - LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' " + identifier); + LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' {}", identifier); throw new RestconfDocumentedException( "URI has bad format. End of URI should be in format \'moduleName/yyyy-MM-dd\'", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE); diff --git a/restconf/sal-rest-docgen-maven/src/main/java/org/opendaylight/netconf/sal/rest/doc/maven/StaticDocGenerator.java b/restconf/sal-rest-docgen-maven/src/main/java/org/opendaylight/netconf/sal/rest/doc/maven/StaticDocGenerator.java index 4ce00e647a..12baa4717e 100644 --- a/restconf/sal-rest-docgen-maven/src/main/java/org/opendaylight/netconf/sal/rest/doc/maven/StaticDocGenerator.java +++ b/restconf/sal-rest-docgen-maven/src/main/java/org/opendaylight/netconf/sal/rest/doc/maven/StaticDocGenerator.java @@ -76,7 +76,7 @@ public class StaticDocGenerator extends BaseYangSwaggerGeneratorDraft02 // Create JS file File resourcesJsFile = new File(outputDir, "resources.js"); if (!resourcesJsFile.createNewFile()) { - LOG.info("File " + resourcesJsFile + " already exists."); + LOG.info("File {} already exists.", resourcesJsFile); } try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(resourcesJsFile))) { diff --git a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java index b9f5290eff..a47f502316 100644 --- a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java +++ b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java @@ -68,7 +68,7 @@ public abstract class BaseYangSwaggerGenerator { private final ObjectMapper mapper = new ObjectMapper(); private final DOMSchemaService schemaService; - protected BaseYangSwaggerGenerator(Optional schemaService) { + protected BaseYangSwaggerGenerator(final Optional schemaService) { this.schemaService = schemaService.orElse(null); this.mapper.configure(SerializationFeature.INDENT_OUTPUT, true); } @@ -238,7 +238,7 @@ public abstract class BaseYangSwaggerGenerator { models = this.jsonConverter.convertToJsonSchema(module, schemaContext); doc.setModels(models); if (LOG.isDebugEnabled()) { - LOG.debug(this.mapper.writeValueAsString(doc)); + LOG.debug("Document: {}", this.mapper.writeValueAsString(doc)); } } catch (IOException e) { LOG.error("Exception occured in ModelGenerator", e);