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 void execute(
final URIAuthority authority = request.getAuthority(); final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme(); 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); final String via = generateViaHeader(request);
// default response context // default response context

View File

@ -151,7 +151,7 @@ public ClassicHttpResponse execute(
final URIAuthority authority = request.getAuthority(); final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme(); 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); final String via = generateViaHeader(request);
// default response context // default response context

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -73,7 +73,7 @@ public static HttpHost resolveAuthTarget(final HttpRequest request, final HttpRo
Args.notNull(route, "Route"); Args.notNull(route, "Route");
final URIAuthority authority = request.getAuthority(); final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme(); 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) { if (target.getPort() < 0) {
return new HttpHost( return new HttpHost(
target.getHostName(), target.getHostName(),

View File

@ -248,7 +248,7 @@ public void completed(final AsyncExecRuntime runtime) {
} }
try { try {
endpoint.execute(exchangeHandler, context); endpoint.execute(exchangeHandler, context);
} catch (RuntimeException ex) { } catch (final RuntimeException ex) {
failed(ex); failed(ex);
} }
} }

View File

@ -171,7 +171,7 @@ public void completed() {
scope.execRuntime.releaseConnection(); scope.execRuntime.releaseConnection();
} }
internalExecute(state, chain, asyncExecCallback); internalExecute(state, chain, asyncExecCallback);
} catch (IOException | HttpException ex) { } catch (final IOException | HttpException ex) {
asyncExecCallback.failed(ex); asyncExecCallback.failed(ex);
} }
} }

View File

@ -101,7 +101,7 @@ public void failed(final Exception cause) {
scope.execRuntime.discardConnection(); scope.execRuntime.discardConnection();
internalExecute(execCount + 1, request, entityProducer, scope, chain, asyncExecCallback); internalExecute(execCount + 1, request, entityProducer, scope, chain, asyncExecCallback);
return; return;
} catch (IOException | HttpException ex) { } catch (final IOException | HttpException ex) {
log.error(ex.getMessage(), ex); log.error(ex.getMessage(), ex);
} }
} }

View File

@ -256,7 +256,7 @@ public void sendRequest(
}); });
} catch (HttpException | IOException ex) { } catch (final HttpException | IOException ex) {
future.failed(ex); future.failed(ex);
} }
return future; return future;

View File

@ -172,9 +172,9 @@ private SSLEngine createSSLEngine()
{ {
sslContext = SSLContexts.custom().build(); 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() final X509TrustManager tm = new X509TrustManager()

View File

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

View File

@ -1812,7 +1812,7 @@ private byte[] addGssMicAvsToTargetInfo( final byte[] originalTargetInfo,
final MessageDigest md5 = getMD5(); final MessageDigest md5 = getMD5();
channelBindingsHash = md5.digest( channelBindingStruct ); channelBindingsHash = md5.digest( channelBindingStruct );
} }
catch ( CertificateEncodingException | NoSuchAlgorithmException e ) catch (final CertificateEncodingException | NoSuchAlgorithmException e )
{ {
throw new NTLMEngineException( e.getMessage(), e ); throw new NTLMEngineException( e.getMessage(), e );
} }

View File

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

View File

@ -98,7 +98,7 @@ public void writeTo(final OutputStream outstream) throws IOException {
super.writeTo(outstream); super.writeTo(outstream);
} }
releaseConnection(); releaseConnection();
} catch (IOException | RuntimeException ex) { } catch (final IOException | RuntimeException ex) {
discardConnection(); discardConnection();
throw ex; throw ex;
} finally { } finally {
@ -115,7 +115,7 @@ public boolean eofDetected(final InputStream wrapped) throws IOException {
wrapped.close(); wrapped.close();
} }
releaseConnection(); releaseConnection();
} catch (IOException | RuntimeException ex) { } catch (final IOException | RuntimeException ex) {
discardConnection(); discardConnection();
throw ex; throw ex;
} finally { } finally {
@ -140,7 +140,7 @@ public boolean streamClosed(final InputStream wrapped) throws IOException {
throw ex; throw ex;
} }
} }
} catch (IOException | RuntimeException ex) { } catch (final IOException | RuntimeException ex) {
discardConnection(); discardConnection();
throw ex; throw ex;
} finally { } finally {

View File

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

View File

@ -268,7 +268,7 @@ static String extractCN(final String subjectPrincipal) throws SSLException {
if (value != null) { if (value != null) {
return value.toString(); return value.toString();
} }
} catch (NoSuchElementException | NamingException ignore) { } catch (final NoSuchElementException | NamingException ignore) {
// ignore exception // ignore exception
} }
} }

View File

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

View File

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

View File

@ -336,7 +336,7 @@ private static class HttpRequestMatcher implements ArgumentMatcher<ClassicHttpRe
public boolean matches(final ClassicHttpRequest argument) { public boolean matches(final ClassicHttpRequest argument) {
try { try {
return requestUri.equals(argument.getUri()); return requestUri.equals(argument.getUri());
} catch (URISyntaxException e) { } catch (final URISyntaxException ex) {
return false; return false;
} }
} }