Fixed style check violations (no functional changes)

This commit is contained in:
Oleg Kalnichevski 2017-11-01 22:30:52 +01:00
parent a403075948
commit 87865c5cd5
24 changed files with 48 additions and 47 deletions

View File

@ -156,7 +156,7 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();;
final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
final String via = generateViaHeader(request);
// default response context

View File

@ -151,7 +151,7 @@ public class CachingExec extends CachingExecBase implements ExecChainHandler {
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();;
final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
final String via = generateViaHeader(request);
// default response context

View File

@ -14,7 +14,7 @@
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# under the License.
#
proxyconfigurator.name = Apache HTTP Components Proxy Configurator

View File

@ -90,7 +90,7 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
final URI uri;
try {
uri = request.getUri();
} catch (URISyntaxException ex) {
} catch (final URISyntaxException ex) {
throw new ProtocolException(ex.getMessage(), ex);
}
final String path = uri.getPath();

View File

@ -80,7 +80,7 @@ public class RandomHandler implements HttpRequestHandler {
final URI uri;
try {
uri = request.getUri();
} catch (URISyntaxException ex) {
} catch (final URISyntaxException ex) {
throw new ProtocolException(ex.getMessage(), ex);
}
final String path = uri.getPath();

View File

@ -177,10 +177,10 @@ public class HttpAsyncClientCompatibilityTest {
} else {
logResult(TestResult.NOK, options, "(status " + code + ")");
}
} catch (ExecutionException ex) {
} catch (final ExecutionException ex) {
final Throwable cause = ex.getCause();
logResult(TestResult.NOK, options, "(" + cause.getMessage() + ")");
} catch (TimeoutException ex) {
} catch (final TimeoutException ex) {
logResult(TestResult.NOK, options, "(time out)");
}
}
@ -191,7 +191,7 @@ public class HttpAsyncClientCompatibilityTest {
context.setCredentialsProvider(credentialsProvider);
final String[] requestUris = new String[] {"/", "/news.html", "/status.html"};
for (String requestUri: requestUris) {
for (final String requestUri: requestUris) {
final SimpleHttpRequest httpGet = SimpleHttpRequest.get(target, requestUri);
final Future<SimpleHttpResponse> future = client.execute(httpGet, context, null);
try {
@ -202,10 +202,10 @@ public class HttpAsyncClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGet, "(status " + code + ")");
}
} catch (ExecutionException ex) {
} catch (final ExecutionException ex) {
final Throwable cause = ex.getCause();
logResult(TestResult.NOK, httpGet, "(" + cause.getMessage() + ")");
} catch (TimeoutException ex) {
} catch (final TimeoutException ex) {
logResult(TestResult.NOK, httpGet, "(time out)");
}
}
@ -229,10 +229,10 @@ public class HttpAsyncClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (ExecutionException ex) {
} catch (final ExecutionException ex) {
final Throwable cause = ex.getCause();
logResult(TestResult.NOK, httpGetSecret, "(" + cause.getMessage() + ")");
} catch (TimeoutException ex) {
} catch (final TimeoutException ex) {
logResult(TestResult.NOK, httpGetSecret, "(time out)");
}
}
@ -255,10 +255,10 @@ public class HttpAsyncClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (ExecutionException ex) {
} catch (final ExecutionException ex) {
final Throwable cause = ex.getCause();
logResult(TestResult.NOK, httpGetSecret, "(" + cause.getMessage() + ")");
} catch (TimeoutException ex) {
} catch (final TimeoutException ex) {
logResult(TestResult.NOK, httpGetSecret, "(time out)");
}
}
@ -281,10 +281,10 @@ public class HttpAsyncClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (ExecutionException ex) {
} catch (final ExecutionException ex) {
final Throwable cause = ex.getCause();
logResult(TestResult.NOK, httpGetSecret, "(" + cause.getMessage() + ")");
} catch (TimeoutException ex) {
} catch (final TimeoutException ex) {
logResult(TestResult.NOK, httpGetSecret, "(time out)");
}
}
@ -309,10 +309,10 @@ public class HttpAsyncClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (ExecutionException ex) {
} catch (final ExecutionException ex) {
final Throwable cause = ex.getCause();
logResult(TestResult.NOK, httpGetSecret, "(" + cause.getMessage() + ")");
} catch (TimeoutException ex) {
} catch (final TimeoutException ex) {
logResult(TestResult.NOK, httpGetSecret, "(time out)");
}
}

View File

@ -151,7 +151,7 @@ public class HttpClientCompatibilityTest {
} else {
logResult(TestResult.NOK, options, "(status " + code + ")");
}
} catch (Exception ex) {
} catch (final Exception ex) {
logResult(TestResult.NOK, options, "(" + ex.getMessage() + ")");
}
}
@ -161,7 +161,7 @@ public class HttpClientCompatibilityTest {
final HttpClientContext context = HttpClientContext.create();
context.setCredentialsProvider(credentialsProvider);
final String[] requestUris = new String[] {"/", "/news.html", "/status.html"};
for (String requestUri: requestUris) {
for (final String requestUri: requestUris) {
final HttpGet httpGet = new HttpGet(requestUri);
try (ClassicHttpResponse response = client.execute(target, httpGet, context)) {
final int code = response.getCode();
@ -171,7 +171,7 @@ public class HttpClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGet, "(status " + code + ")");
}
} catch (Exception ex) {
} catch (final Exception ex) {
logResult(TestResult.NOK, httpGet, "(" + ex.getMessage() + ")");
}
}
@ -194,7 +194,7 @@ public class HttpClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (Exception ex) {
} catch (final Exception ex) {
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
}
}
@ -216,7 +216,7 @@ public class HttpClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (Exception ex) {
} catch (final Exception ex) {
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
}
}
@ -238,7 +238,7 @@ public class HttpClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (Exception ex) {
} catch (final Exception ex) {
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
}
}
@ -261,7 +261,7 @@ public class HttpClientCompatibilityTest {
} else {
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
}
} catch (Exception ex) {
} catch (final Exception ex) {
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
}
}

View File

@ -101,7 +101,7 @@ public class TestRedirects extends LocalServerTestBase {
response.setCode(HttpStatus.SC_NOT_FOUND);
}
} catch (URISyntaxException ex) {
} catch (final URISyntaxException ex) {
throw new ProtocolException(ex.getMessage(), ex);
}
}

View File

@ -63,7 +63,7 @@ public enum StandardMethods {
}
try {
return valueOf(value.toUpperCase(Locale.ROOT)).safe;
} catch (IllegalArgumentException ex) {
} catch (final IllegalArgumentException ex) {
return false;
}
}
@ -74,7 +74,7 @@ public enum StandardMethods {
}
try {
return valueOf(value.toUpperCase(Locale.ROOT)).idempotent;
} catch (IllegalArgumentException ex) {
} catch (final IllegalArgumentException ex) {
return false;
}
}

View File

@ -73,7 +73,7 @@ public class AuthSupport {
Args.notNull(route, "Route");
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();;
final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
if (target.getPort() < 0) {
return new HttpHost(
target.getHostName(),

View File

@ -248,7 +248,7 @@ class AsyncExecRuntimeImpl implements AsyncExecRuntime {
}
try {
endpoint.execute(exchangeHandler, context);
} catch (RuntimeException ex) {
} catch (final RuntimeException ex) {
failed(ex);
}
}

View File

@ -171,7 +171,7 @@ class AsyncRedirectExec implements AsyncExecChainHandler {
scope.execRuntime.releaseConnection();
}
internalExecute(state, chain, asyncExecCallback);
} catch (IOException | HttpException ex) {
} catch (final IOException | HttpException ex) {
asyncExecCallback.failed(ex);
}
}

View File

@ -101,7 +101,7 @@ class AsyncRetryExec implements AsyncExecChainHandler {
scope.execRuntime.discardConnection();
internalExecute(execCount + 1, request, entityProducer, scope, chain, asyncExecCallback);
return;
} catch (IOException | HttpException ex) {
} catch (final IOException | HttpException ex) {
log.error(ex.getMessage(), ex);
}
}

View File

@ -256,7 +256,7 @@ class InternalHttpAsyncClient extends AbstractHttpAsyncClientBase {
});
} catch (HttpException | IOException ex) {
} catch (final HttpException | IOException ex) {
future.failed(ex);
}
return future;

View File

@ -172,9 +172,9 @@ public class CredSspScheme implements AuthScheme
{
sslContext = SSLContexts.custom().build();
}
catch ( NoSuchAlgorithmException | KeyManagementException e )
catch (final NoSuchAlgorithmException | KeyManagementException ex )
{
throw new SSLInitializationException( "Error creating SSL Context: " + e.getMessage(), e );
throw new SSLInitializationException( "Error creating SSL Context: " + ex.getMessage(), ex );
}
final X509TrustManager tm = new X509TrustManager()

View File

@ -234,7 +234,7 @@ public class HttpAuthenticator {
if (authScheme.isResponseReady(host, credsProvider, context)) {
authOptions.add(authScheme);
}
} catch (AuthenticationException | MalformedChallengeException ex) {
} catch (final AuthenticationException | MalformedChallengeException ex) {
if (this.log.isWarnEnabled()) {
this.log.warn(ex.getMessage());
}

View File

@ -1812,7 +1812,7 @@ final class NTLMEngineImpl implements NTLMEngine {
final MessageDigest md5 = getMD5();
channelBindingsHash = md5.digest( channelBindingStruct );
}
catch ( CertificateEncodingException | NoSuchAlgorithmException e )
catch (final CertificateEncodingException | NoSuchAlgorithmException e )
{
throw new NTLMEngineException( e.getMessage(), e );
}

View File

@ -106,7 +106,7 @@ public class SystemDefaultCredentialsProvider implements CredentialsStore {
try {
final URI uri = request != null ? request.getUri() : null;
targetHostURL = uri != null ? uri.toURL() : null;
} catch (URISyntaxException | MalformedURLException ignore) {
} catch (final URISyntaxException | MalformedURLException ignore) {
targetHostURL = null;
}
// use null addr, because the authentication fails if it does not exactly match the expected realm's host

View File

@ -98,7 +98,7 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
super.writeTo(outstream);
}
releaseConnection();
} catch (IOException | RuntimeException ex) {
} catch (final IOException | RuntimeException ex) {
discardConnection();
throw ex;
} finally {
@ -115,7 +115,7 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
wrapped.close();
}
releaseConnection();
} catch (IOException | RuntimeException ex) {
} catch (final IOException | RuntimeException ex) {
discardConnection();
throw ex;
} finally {
@ -140,7 +140,7 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
throw ex;
}
}
} catch (IOException | RuntimeException ex) {
} catch (final IOException | RuntimeException ex) {
discardConnection();
throw ex;
} finally {

View File

@ -233,8 +233,9 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
@Override
public void completed(final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poolEntry) {
final ManagedAsyncClientConnection connection = poolEntry.getConnection();
if (TimeValue.isPositive(validateAfterInactivity) && connection != null &&
poolEntry.getUpdated() + validateAfterInactivity.toMillis() <= System.currentTimeMillis()) {
final TimeValue timeValue = PoolingAsyncClientConnectionManager.this.validateAfterInactivity;
if (TimeValue.isPositive(timeValue) && connection != null &&
poolEntry.getUpdated() + timeValue.toMillis() <= System.currentTimeMillis()) {
final ProtocolVersion protocolVersion = connection.getProtocolVersion();
if (HttpVersion.HTTP_2_0.greaterEquals(protocolVersion)) {
connection.submitPriorityCommand(new PingCommand(new BasicPingHandler(new Callback<Boolean>() {

View File

@ -268,7 +268,7 @@ public final class DefaultHostnameVerifier implements HttpClientHostnameVerifier
if (value != null) {
return value.toString();
}
} catch (NoSuchElementException | NamingException ignore) {
} catch (final NoSuchElementException | NamingException ignore) {
// ignore exception
}
}

View File

@ -14,7 +14,7 @@
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# under the License.
#
info.module = HttpClient
info.release = ${pom.version}

View File

@ -251,7 +251,7 @@ public class TestMainClientExec {
final ExecChain.Scope scope = new ExecChain.Scope("test", route, request, endpoint, context);
try {
mainClientExec.execute(request, scope, null);
} catch (Exception ex) {
} catch (final Exception ex) {
Mockito.verify(endpoint).discardConnection();
throw ex;
}

View File

@ -336,7 +336,7 @@ public class TestRedirectExec {
public boolean matches(final ClassicHttpRequest argument) {
try {
return requestUri.equals(argument.getUri());
} catch (URISyntaxException e) {
} catch (final URISyntaxException ex) {
return false;
}
}