From 87865c5cd5003d0762ccd8d646c30b51b8958ba7 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Wed, 1 Nov 2017 22:30:52 +0100 Subject: [PATCH] Fixed style check violations (no functional changes) --- .../http/impl/cache/AsyncCachingExec.java | 2 +- .../client5/http/impl/cache/CachingExec.java | 2 +- .../OSGI-INF/metatype/metatype.properties | 2 +- .../testing/async/AsyncRandomHandler.java | 2 +- .../testing/classic/RandomHandler.java | 2 +- .../HttpAsyncClientCompatibilityTest.java | 26 +++++++++---------- .../external/HttpClientCompatibilityTest.java | 14 +++++----- .../client5/testing/sync/TestRedirects.java | 2 +- .../hc/client5/http/StandardMethods.java | 4 +-- .../hc/client5/http/impl/AuthSupport.java | 2 +- .../http/impl/async/AsyncExecRuntimeImpl.java | 2 +- .../http/impl/async/AsyncRedirectExec.java | 2 +- .../http/impl/async/AsyncRetryExec.java | 2 +- .../impl/async/InternalHttpAsyncClient.java | 2 +- .../client5/http/impl/auth/CredSspScheme.java | 4 +-- .../http/impl/auth/HttpAuthenticator.java | 2 +- .../http/impl/auth/NTLMEngineImpl.java | 2 +- .../SystemDefaultCredentialsProvider.java | 2 +- .../impl/classic/ResponseEntityProxy.java | 6 ++--- .../PoolingAsyncClientConnectionManager.java | 5 ++-- .../http/ssl/DefaultHostnameVerifier.java | 2 +- .../org/apache/hc/client5/version.properties | 2 +- .../http/impl/classic/TestMainClientExec.java | 2 +- .../http/impl/classic/TestRedirectExec.java | 2 +- 24 files changed, 48 insertions(+), 47 deletions(-) diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java index 36aedaa5e..2b4a8dc72 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java @@ -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 diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java index d5e06c5c8..83f74cbdb 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java @@ -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 diff --git a/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties b/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties index a3360b969..888a023ae 100644 --- a/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties +++ b/httpclient5-osgi/src/main/resources/OSGI-INF/metatype/metatype.properties @@ -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 diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java index 9e44db319..57bb64dd1 100644 --- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java +++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java @@ -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(); diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java index bd9fcde05..e8d944d19 100644 --- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java +++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java @@ -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(); diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java index 33e02ca70..ea653276e 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java @@ -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 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)"); } } diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java index bcaea20ad..f8c9ccddb 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java @@ -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() + ")"); } } diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java index 08ff315c7..ab8ec57b3 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java @@ -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); } } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java b/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java index cc9034255..3ac56821a 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java @@ -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; } } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java index f2dae38e8..c53a5cd79 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java @@ -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(), diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncExecRuntimeImpl.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncExecRuntimeImpl.java index 8c90c3513..1cbf8a68d 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncExecRuntimeImpl.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncExecRuntimeImpl.java @@ -248,7 +248,7 @@ class AsyncExecRuntimeImpl implements AsyncExecRuntime { } try { endpoint.execute(exchangeHandler, context); - } catch (RuntimeException ex) { + } catch (final RuntimeException ex) { failed(ex); } } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java index 0f13a0792..3b2982061 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java @@ -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); } } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRetryExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRetryExec.java index 82fc6f920..d08cc1f03 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRetryExec.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRetryExec.java @@ -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); } } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncClient.java index e1370e815..431111ca2 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncClient.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncClient.java @@ -256,7 +256,7 @@ class InternalHttpAsyncClient extends AbstractHttpAsyncClientBase { }); - } catch (HttpException | IOException ex) { + } catch (final HttpException | IOException ex) { future.failed(ex); } return future; diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java index 5c8403d19..e87685dc3 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/CredSspScheme.java @@ -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() diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java index d2c7807f4..372f7e425 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/HttpAuthenticator.java @@ -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()); } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java index 271c304f6..3ebb3dc29 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java @@ -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 ); } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java index e0aa8bb8b..958644ee6 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java @@ -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 diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java index c521bdb2c..6dcdcad59 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java @@ -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 { diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java index b393a6520..1cad08535 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java @@ -233,8 +233,9 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio @Override public void completed(final PoolEntry 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() { diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java index d4bbe0e71..41c738379 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/DefaultHostnameVerifier.java @@ -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 } } diff --git a/httpclient5/src/main/resources/org/apache/hc/client5/version.properties b/httpclient5/src/main/resources/org/apache/hc/client5/version.properties index a57a8284f..842fb6b57 100644 --- a/httpclient5/src/main/resources/org/apache/hc/client5/version.properties +++ b/httpclient5/src/main/resources/org/apache/hc/client5/version.properties @@ -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} diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java index bef2fa037..c59cd3020 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestMainClientExec.java @@ -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; } diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java index 2339a8912..7fdb4cc61 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java @@ -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; } }