Sonar Fixes

- avoid parameter assignments
This commit is contained in:
Gary Russell
2019-01-04 13:20:17 -05:00
committed by Artem Bilan
parent 76439e3440
commit 1bafe89d49
29 changed files with 236 additions and 163 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -572,7 +572,8 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
}
}
protected TcpConnectionSupport wrapConnection(TcpConnectionSupport connection) throws Exception {
protected TcpConnectionSupport wrapConnection(TcpConnectionSupport connectionArg) throws Exception {
TcpConnectionSupport connection = connectionArg;
try {
if (this.interceptorFactoryChain == null) {
return connection;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -361,14 +361,15 @@ public class TcpNioSSLConnection extends TcpNioConnection {
* Handles SSL handshaking; when network data is needed from the peer, suspends
* until that data is received.
*/
private void doClientSideHandshake(ByteBuffer plainText, SSLEngineResult result) throws IOException {
private void doClientSideHandshake(ByteBuffer plainText, SSLEngineResult resultArg) throws IOException {
SSLEngineResult result = resultArg;
TcpNioSSLConnection.this.semaphore.drainPermits();
HandshakeStatus status = TcpNioSSLConnection.this.sslEngine.getHandshakeStatus();
while (status != HandshakeStatus.FINISHED) {
writeEncodedIfAny();
status = runTasksIfNeeded(result);
if (status == HandshakeStatus.NEED_UNWRAP) {
status = waitForHandshakeData(result, status);
status = waitForHandshakeData(result);
}
if (status == HandshakeStatus.NEED_WRAP ||
status == HandshakeStatus.NOT_HANDSHAKING ||
@@ -395,8 +396,8 @@ public class TcpNioSSLConnection extends TcpNioConnection {
/**
* Suspend processing until data is received from the peer.
*/
private HandshakeStatus waitForHandshakeData(SSLEngineResult result,
HandshakeStatus status) throws IOException {
private HandshakeStatus waitForHandshakeData(SSLEngineResult result) throws IOException {
try {
logger.trace("Writer waiting for handshake");
if (!TcpNioSSLConnection.this.semaphore.tryAcquire(TcpNioSSLConnection.this.handshakeTimeout,
@@ -412,13 +413,12 @@ public class TcpNioSSLConnection extends TcpNioConnection {
}
}
logger.trace("Writer resuming handshake");
status = runTasksIfNeeded(result);
return runTasksIfNeeded(result);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new MessagingException("Interrupted during SSL Handshaking");
}
return status;
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.integration.ip.util;
import org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter;
import org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory;
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
import org.springframework.lang.Nullable;
/**
* Convenience class providing methods for testing IP components.
@@ -39,11 +40,13 @@ public final class TestingUtilities {
* Wait for a server connection factory to actually start listening before
* starting a test. Waits for up to 10 seconds by default.
* @param serverConnectionFactory The server connection factory.
* @param delay How long to wait in milliseconds; default 10000 (10 seconds) if null.
* @param delayArg How long to wait in milliseconds; default 10000 (10 seconds) if null.
* @throws IllegalStateException If the server does not start listening in time.
*/
public static void waitListening(AbstractServerConnectionFactory serverConnectionFactory, Long delay)
throws IllegalStateException {
public static void waitListening(AbstractServerConnectionFactory serverConnectionFactory, @Nullable Long delayArg)
throws IllegalStateException {
Long delay = delayArg;
if (delay == null) {
delay = 100L;
}
@@ -70,11 +73,13 @@ public final class TestingUtilities {
* Wait for a server connection factory to actually start listening before
* starting a test. Waits for up to 10 seconds by default.
* @param adapter The server connection factory.
* @param delay How long to wait in milliseconds; default 10000 (10 seconds) if null.
* @param delayArg How long to wait in milliseconds; default 10000 (10 seconds) if null.
* @throws IllegalStateException If the server does not start listening in time.
*/
public static void waitListening(AbstractInternetProtocolReceivingChannelAdapter adapter, Long delay)
throws IllegalStateException {
public static void waitListening(AbstractInternetProtocolReceivingChannelAdapter adapter, @Nullable Long delayArg)
throws IllegalStateException {
Long delay = delayArg;
if (delay == null) {
delay = 100L;
}
@@ -101,11 +106,13 @@ public final class TestingUtilities {
* Wait for a server connection factory to stop listening.
* Waits for up to 10 seconds by default.
* @param serverConnectionFactory The server connection factory.
* @param delay How long to wait in milliseconds; default 10000 (10 seconds) if null.
* @param delayArg How long to wait in milliseconds; default 10000 (10 seconds) if null.
* @throws IllegalStateException If the server doesn't stop listening in time.
*/
public static void waitStopListening(AbstractServerConnectionFactory serverConnectionFactory, Long delay)
public static void waitStopListening(AbstractServerConnectionFactory serverConnectionFactory, @Nullable Long delayArg)
throws IllegalStateException {
Long delay = delayArg;
if (delay == null) {
delay = 100L;
}