mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-16 23:16:33 +00:00
Fixed style check violations (no functional changes)
This commit is contained in:
parent
a403075948
commit
87865c5cd5
@ -156,7 +156,7 @@ public void execute(
|
||||
|
||||
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
|
||||
|
@ -151,7 +151,7 @@ public ClassicHttpResponse execute(
|
||||
|
||||
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
|
||||
|
@ -90,7 +90,7 @@ public void handleRequest(
|
||||
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();
|
||||
|
@ -80,7 +80,7 @@ public void handle(final ClassicHttpRequest request,
|
||||
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();
|
||||
|
@ -177,10 +177,10 @@ void execute() throws Exception {
|
||||
} 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 @@ void execute() throws Exception {
|
||||
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 @@ void execute() throws Exception {
|
||||
} 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 @@ void execute() throws Exception {
|
||||
} 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 @@ void execute() throws Exception {
|
||||
} 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 @@ void execute() throws Exception {
|
||||
} 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 @@ void execute() throws Exception {
|
||||
} 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)");
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ void execute() {
|
||||
} else {
|
||||
logResult(TestResult.NOK, options, "(status " + code + ")");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
logResult(TestResult.NOK, options, "(" + ex.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ void execute() {
|
||||
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 @@ void execute() {
|
||||
} else {
|
||||
logResult(TestResult.NOK, httpGet, "(status " + code + ")");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
logResult(TestResult.NOK, httpGet, "(" + ex.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
@ -194,7 +194,7 @@ void execute() {
|
||||
} else {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ void execute() {
|
||||
} else {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,7 @@ void execute() {
|
||||
} else {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ void execute() {
|
||||
} else {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(status " + code + ")");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
logResult(TestResult.NOK, httpGetSecret, "(" + ex.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public void handle(
|
||||
response.setCode(HttpStatus.SC_NOT_FOUND);
|
||||
}
|
||||
|
||||
} catch (URISyntaxException ex) {
|
||||
} catch (final URISyntaxException ex) {
|
||||
throw new ProtocolException(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public static boolean isSafe(final String value) {
|
||||
}
|
||||
try {
|
||||
return valueOf(value.toUpperCase(Locale.ROOT)).safe;
|
||||
} catch (IllegalArgumentException ex) {
|
||||
} catch (final IllegalArgumentException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ public static boolean isIdempotent(final String value) {
|
||||
}
|
||||
try {
|
||||
return valueOf(value.toUpperCase(Locale.ROOT)).idempotent;
|
||||
} catch (IllegalArgumentException ex) {
|
||||
} catch (final IllegalArgumentException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public static HttpHost resolveAuthTarget(final HttpRequest request, final HttpRo
|
||||
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(),
|
||||
|
@ -248,7 +248,7 @@ public void completed(final AsyncExecRuntime runtime) {
|
||||
}
|
||||
try {
|
||||
endpoint.execute(exchangeHandler, context);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (final RuntimeException ex) {
|
||||
failed(ex);
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ public void completed() {
|
||||
scope.execRuntime.releaseConnection();
|
||||
}
|
||||
internalExecute(state, chain, asyncExecCallback);
|
||||
} catch (IOException | HttpException ex) {
|
||||
} catch (final IOException | HttpException ex) {
|
||||
asyncExecCallback.failed(ex);
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public void failed(final Exception cause) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public void sendRequest(
|
||||
|
||||
});
|
||||
|
||||
} catch (HttpException | IOException ex) {
|
||||
} catch (final HttpException | IOException ex) {
|
||||
future.failed(ex);
|
||||
}
|
||||
return future;
|
||||
|
@ -172,9 +172,9 @@ private SSLEngine createSSLEngine()
|
||||
{
|
||||
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()
|
||||
|
@ -234,7 +234,7 @@ public boolean prepareAuthResponse(
|
||||
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());
|
||||
}
|
||||
|
@ -1812,7 +1812,7 @@ private byte[] addGssMicAvsToTargetInfo( final byte[] originalTargetInfo,
|
||||
final MessageDigest md5 = getMD5();
|
||||
channelBindingsHash = md5.digest( channelBindingStruct );
|
||||
}
|
||||
catch ( CertificateEncodingException | NoSuchAlgorithmException e )
|
||||
catch (final CertificateEncodingException | NoSuchAlgorithmException e )
|
||||
{
|
||||
throw new NTLMEngineException( e.getMessage(), e );
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ private static PasswordAuthentication getSystemCreds(
|
||||
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
|
||||
|
@ -98,7 +98,7 @@ public void writeTo(final OutputStream outstream) throws IOException {
|
||||
super.writeTo(outstream);
|
||||
}
|
||||
releaseConnection();
|
||||
} catch (IOException | RuntimeException ex) {
|
||||
} catch (final IOException | RuntimeException ex) {
|
||||
discardConnection();
|
||||
throw ex;
|
||||
} finally {
|
||||
@ -115,7 +115,7 @@ public boolean eofDetected(final InputStream wrapped) throws IOException {
|
||||
wrapped.close();
|
||||
}
|
||||
releaseConnection();
|
||||
} catch (IOException | RuntimeException ex) {
|
||||
} catch (final IOException | RuntimeException ex) {
|
||||
discardConnection();
|
||||
throw ex;
|
||||
} finally {
|
||||
@ -140,7 +140,7 @@ public boolean streamClosed(final InputStream wrapped) throws IOException {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
} catch (IOException | RuntimeException ex) {
|
||||
} catch (final IOException | RuntimeException ex) {
|
||||
discardConnection();
|
||||
throw ex;
|
||||
} finally {
|
||||
|
@ -233,8 +233,9 @@ void leaseCompleted(final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poo
|
||||
@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>() {
|
||||
|
@ -268,7 +268,7 @@ static String extractCN(final String subjectPrincipal) throws SSLException {
|
||||
if (value != null) {
|
||||
return value.toString();
|
||||
}
|
||||
} catch (NoSuchElementException | NamingException ignore) {
|
||||
} catch (final NoSuchElementException | NamingException ignore) {
|
||||
// ignore exception
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public void testExecConnectionShutDown() throws Exception {
|
||||
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;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ private static class HttpRequestMatcher implements ArgumentMatcher<ClassicHttpRe
|
||||
public boolean matches(final ClassicHttpRequest argument) {
|
||||
try {
|
||||
return requestUri.equals(argument.getUri());
|
||||
} catch (URISyntaxException e) {
|
||||
} catch (final URISyntaxException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user