You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2018/11/07 19:33:16 UTC
httpcomponents-core git commit: Use final.
Repository: httpcomponents-core
Updated Branches:
refs/heads/master 3adede014 -> 924542bbf
Use final.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/924542bb
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/924542bb
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/924542bb
Branch: refs/heads/master
Commit: 924542bbf5d0c55da337210cacb9a89f14f7685d
Parents: 3adede0
Author: Gary Gregory <ga...@gmail.com>
Authored: Wed Nov 7 12:33:13 2018 -0700
Committer: Gary Gregory <ga...@gmail.com>
Committed: Wed Nov 7 12:33:13 2018 -0700
----------------------------------------------------------------------
.../http/examples/AsyncFileServerExample.java | 18 ++--
.../examples/AsyncFullDuplexClientExample.java | 10 +--
.../examples/AsyncFullDuplexServerExample.java | 8 +-
.../AsyncPipelinedRequestExecutionExample.java | 16 ++--
.../examples/AsyncRequestExecutionExample.java | 12 +--
.../http/examples/AsyncReverseProxyExample.java | 94 ++++++++++----------
.../http/examples/AsyncServerFilterExample.java | 8 +-
.../http/examples/ClassicFileServerExample.java | 26 +++---
.../examples/ClassicGetExecutionExample.java | 14 +--
.../examples/ClassicPostExecutionExample.java | 14 +--
...ClassicPostWithTrailersExecutionExample.java | 14 +--
.../examples/ClassicReverseProxyExample.java | 14 +--
.../examples/ClassicServerFilterExample.java | 6 +-
.../core5/http/examples/PrintVersionInfo.java | 4 +-
14 files changed, 129 insertions(+), 129 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
index 2e475af..727eb6d 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
@@ -63,7 +63,7 @@ import org.apache.hc.core5.util.TimeValue;
*/
public class AsyncFileServerExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Please specify document root directory");
System.exit(1);
@@ -75,7 +75,7 @@ public class AsyncFileServerExample {
port = Integer.parseInt(args[1]);
}
- IOReactorConfig config = IOReactorConfig.custom()
+ final IOReactorConfig config = IOReactorConfig.custom()
.setSoTimeout(15, TimeUnit.SECONDS)
.setTcpNoDelay(true)
.build();
@@ -97,14 +97,14 @@ public class AsyncFileServerExample {
final Message<HttpRequest, Void> message,
final ResponseTrigger responseTrigger,
final HttpContext context) throws HttpException, IOException {
- HttpRequest request = message.getHead();
+ final HttpRequest request = message.getHead();
URI requestUri;
try {
requestUri = request.getUri();
- } catch (URISyntaxException ex) {
+ } catch (final URISyntaxException ex) {
throw new ProtocolException(ex.getMessage(), ex);
}
- String path = requestUri.getPath();
+ final String path = requestUri.getPath();
final File file = new File(docRoot, path);
if (!file.exists()) {
@@ -137,8 +137,8 @@ public class AsyncFileServerExample {
contentType = ContentType.DEFAULT_BINARY;
}
- HttpCoreContext coreContext = HttpCoreContext.adapt(context);
- EndpointDetails endpoint = coreContext.getEndpointDetails();
+ final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
+ final EndpointDetails endpoint = coreContext.getEndpointDetails();
System.out.println(endpoint + ": serving file " + file.getPath());
responseTrigger.submitResponse(new BasicResponseProducer(
HttpStatus.SC_OK, new FileEntityProducer(file, contentType)), context);
@@ -157,8 +157,8 @@ public class AsyncFileServerExample {
});
server.start();
- Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
- ListenerEndpoint listenerEndpoint = future.get();
+ final Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
+ final ListenerEndpoint listenerEndpoint = future.get();
System.out.print("Listening on " + listenerEndpoint.getAddress());
server.awaitShutdown(TimeValue.ofDays(Long.MAX_VALUE));
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
index 572e9de..3b16725 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
@@ -67,9 +67,9 @@ import org.apache.hc.core5.util.Timeout;
*/
public class AsyncFullDuplexClientExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
- IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
+ final IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
.setSoTimeout(5, TimeUnit.SECONDS)
.build();
@@ -147,7 +147,7 @@ public class AsyncFullDuplexClientExample {
}
@Override
- public void produceRequest(final RequestChannel channel, HttpContext httpContext) throws HttpException, IOException {
+ public void produceRequest(final RequestChannel channel, final HttpContext httpContext) throws HttpException, IOException {
requestProducer.sendRequest(channel, httpContext);
}
@@ -162,12 +162,12 @@ public class AsyncFullDuplexClientExample {
}
@Override
- public void consumeInformation(final HttpResponse response, HttpContext httpContext) throws HttpException, IOException {
+ public void consumeInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
System.out.println(requestUri + "->" + response.getCode());
}
@Override
- public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException {
+ public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
System.out.println(requestUri + "->" + response.getCode());
responseConsumer.consumeResponse(response, entityDetails, httpContext, null);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
index af46956..d39942f 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
@@ -63,13 +63,13 @@ import org.apache.hc.core5.util.TimeValue;
*/
public class AsyncFullDuplexServerExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
int port = 8080;
if (args.length >= 1) {
port = Integer.parseInt(args[0]);
}
- IOReactorConfig config = IOReactorConfig.custom()
+ final IOReactorConfig config = IOReactorConfig.custom()
.setSoTimeout(15, TimeUnit.SECONDS)
.setTcpNoDelay(true)
.build();
@@ -216,8 +216,8 @@ public class AsyncFullDuplexServerExample {
});
server.start();
- Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
- ListenerEndpoint listenerEndpoint = future.get();
+ final Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
+ final ListenerEndpoint listenerEndpoint = future.get();
System.out.print("Listening on " + listenerEndpoint.getAddress());
server.awaitShutdown(TimeValue.ofDays(Long.MAX_VALUE));
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
index 0021cb2..ab6d003 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
@@ -54,9 +54,9 @@ import org.apache.hc.core5.util.Timeout;
*/
public class AsyncPipelinedRequestExecutionExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
- IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
+ final IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
.setSoTimeout(5, TimeUnit.SECONDS)
.build();
@@ -97,11 +97,11 @@ public class AsyncPipelinedRequestExecutionExample {
});
requester.start();
- HttpHost target = new HttpHost("httpbin.org");
- String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
+ final HttpHost target = new HttpHost("httpbin.org");
+ final String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
- Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
- AsyncClientEndpoint clientEndpoint = future.get();
+ final Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
+ final AsyncClientEndpoint clientEndpoint = future.get();
final CountDownLatch latch = new CountDownLatch(requestUris.length);
for (final String requestUri: requestUris) {
@@ -113,8 +113,8 @@ public class AsyncPipelinedRequestExecutionExample {
@Override
public void completed(final Message<HttpResponse, String> message) {
latch.countDown();
- HttpResponse response = message.getHead();
- String body = message.getBody();
+ final HttpResponse response = message.getHead();
+ final String body = message.getBody();
System.out.println(requestUri + "->" + response.getCode());
System.out.println(body);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
index c61cbf0..976e522 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
@@ -52,9 +52,9 @@ import org.apache.hc.core5.util.Timeout;
*/
public class AsyncRequestExecutionExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
- IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
+ final IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
.setSoTimeout(5, TimeUnit.SECONDS)
.build();
@@ -95,8 +95,8 @@ public class AsyncRequestExecutionExample {
});
requester.start();
- HttpHost target = new HttpHost("httpbin.org");
- String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
+ final HttpHost target = new HttpHost("httpbin.org");
+ final String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
final CountDownLatch latch = new CountDownLatch(requestUris.length);
for (final String requestUri: requestUris) {
@@ -108,8 +108,8 @@ public class AsyncRequestExecutionExample {
@Override
public void completed(final Message<HttpResponse, String> message) {
- HttpResponse response = message.getHead();
- String body = message.getBody();
+ final HttpResponse response = message.getHead();
+ final String body = message.getBody();
System.out.println(requestUri + "->" + response.getCode());
System.out.println(body);
latch.countDown();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
index 36e478f..754add0 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
@@ -86,7 +86,7 @@ import org.apache.hc.core5.util.Timeout;
*/
public class AsyncReverseProxyExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
if (args.length < 1) {
System.out.println("Usage: <hostname[:port]> [listener port]");
System.exit(1);
@@ -100,7 +100,7 @@ public class AsyncReverseProxyExample {
System.out.println("Reverse proxy to " + targetHost);
- IOReactorConfig config = IOReactorConfig.custom()
+ final IOReactorConfig config = IOReactorConfig.custom()
.setSoTimeout(10, TimeUnit.SECONDS)
.build();
@@ -110,16 +110,16 @@ public class AsyncReverseProxyExample {
@Override
public void onLease(final HttpHost route, final ConnPoolStats<HttpHost> connPoolStats) {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("[proxy->origin] connection leased ").append(route);
System.out.println(buf.toString());
}
@Override
public void onRelease(final HttpHost route, final ConnPoolStats<HttpHost> connPoolStats) {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("[proxy->origin] connection released ").append(route);
- PoolStats totals = connPoolStats.getTotalStats();
+ final PoolStats totals = connPoolStats.getTotalStats();
buf.append("; total kept alive: ").append(totals.getAvailable()).append("; ");
buf.append("total allocated: ").append(totals.getLeased() + totals.getAvailable());
buf.append(" of ").append(totals.getMax());
@@ -200,13 +200,13 @@ public class AsyncReverseProxyExample {
private static class ProxyBuffer extends ExpandableBuffer {
- ProxyBuffer(int bufferSize) {
+ ProxyBuffer(final int bufferSize) {
super(bufferSize);
}
void put(final ByteBuffer src) {
setInputMode();
- int requiredCapacity = buffer().position() + src.remaining();
+ final int requiredCapacity = buffer().position() + src.remaining();
ensureCapacity(requiredCapacity);
buffer().put(src);
}
@@ -303,11 +303,11 @@ public class AsyncReverseProxyExample {
@Override
public void failed(final Exception cause) {
- HttpResponse outgoingResponse = new BasicHttpResponse(HttpStatus.SC_SERVICE_UNAVAILABLE);
+ final HttpResponse outgoingResponse = new BasicHttpResponse(HttpStatus.SC_SERVICE_UNAVAILABLE);
outgoingResponse.addHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
exchangeState.response = outgoingResponse;
- ByteBuffer msg = StandardCharsets.US_ASCII.encode(CharBuffer.wrap(cause.getMessage()));
- EntityDetails exEntityDetails = new BasicEntityDetails(msg.remaining(), ContentType.TEXT_PLAIN);
+ final ByteBuffer msg = StandardCharsets.US_ASCII.encode(CharBuffer.wrap(cause.getMessage()));
+ final EntityDetails exEntityDetails = new BasicEntityDetails(msg.remaining(), ContentType.TEXT_PLAIN);
exchangeState.responseEntityDetails = exEntityDetails;
exchangeState.outBuf = new ProxyBuffer(1024);
exchangeState.outBuf.put(msg);
@@ -335,7 +335,7 @@ public class AsyncReverseProxyExample {
public void updateCapacity(final CapacityChannel capacityChannel) throws IOException {
synchronized (exchangeState) {
exchangeState.requestCapacityChannel = capacityChannel;
- int capacity = exchangeState.inBuf != null ? exchangeState.inBuf.capacity() : INIT_BUFFER_SIZE;
+ final int capacity = exchangeState.inBuf != null ? exchangeState.inBuf.capacity() : INIT_BUFFER_SIZE;
if (capacity > 0) {
System.out.println("[client<-proxy] " + exchangeState.id + " input capacity: " + capacity);
capacityChannel.update(capacity);
@@ -347,14 +347,14 @@ public class AsyncReverseProxyExample {
public void consume(final ByteBuffer src) throws IOException {
synchronized (exchangeState) {
System.out.println("[client->proxy] " + exchangeState.id + " " + src.remaining() + " bytes received");
- DataStreamChannel dataChannel = exchangeState.requestDataChannel;
+ final DataStreamChannel dataChannel = exchangeState.requestDataChannel;
if (dataChannel != null && exchangeState.inBuf != null) {
if (exchangeState.inBuf.hasData()) {
- int bytesWritten = exchangeState.inBuf.write(dataChannel);
+ final int bytesWritten = exchangeState.inBuf.write(dataChannel);
System.out.println("[proxy->origin] " + exchangeState.id + " " + bytesWritten + " bytes sent");
}
if (!exchangeState.inBuf.hasData()) {
- int bytesWritten = dataChannel.write(src);
+ final int bytesWritten = dataChannel.write(src);
System.out.println("[proxy->origin] " + exchangeState.id + " " + bytesWritten + " bytes sent");
}
}
@@ -364,7 +364,7 @@ public class AsyncReverseProxyExample {
}
exchangeState.inBuf.put(src);
}
- int capacity = exchangeState.inBuf != null ? exchangeState.inBuf.capacity() : INIT_BUFFER_SIZE;
+ final int capacity = exchangeState.inBuf != null ? exchangeState.inBuf.capacity() : INIT_BUFFER_SIZE;
System.out.println("[client<-proxy] " + exchangeState.id + " input capacity: " + capacity);
if (dataChannel != null) {
dataChannel.requestOutput();
@@ -377,7 +377,7 @@ public class AsyncReverseProxyExample {
synchronized (exchangeState) {
System.out.println("[client->proxy] " + exchangeState.id + " end of input");
exchangeState.inputEnd = true;
- DataStreamChannel dataChannel = exchangeState.requestDataChannel;
+ final DataStreamChannel dataChannel = exchangeState.requestDataChannel;
if (dataChannel != null && (exchangeState.inBuf == null || !exchangeState.inBuf.hasData())) {
System.out.println("[proxy->origin] " + exchangeState.id + " end of output");
dataChannel.endStream();
@@ -388,7 +388,7 @@ public class AsyncReverseProxyExample {
@Override
public int available() {
synchronized (exchangeState) {
- int available = exchangeState.outBuf != null ? exchangeState.outBuf.length() : 0;
+ final int available = exchangeState.outBuf != null ? exchangeState.outBuf.length() : 0;
System.out.println("[client<-proxy] " + exchangeState.id + " output available: " + available);
return available;
}
@@ -402,7 +402,7 @@ public class AsyncReverseProxyExample {
if (exchangeState.outBuf != null) {
if (exchangeState.outBuf.hasData()) {
- int bytesWritten = exchangeState.outBuf.write(channel);
+ final int bytesWritten = exchangeState.outBuf.write(channel);
System.out.println("[client<-proxy] " + exchangeState.id + " " + bytesWritten + " bytes sent");
}
if (exchangeState.outputEnd && !exchangeState.outBuf.hasData()) {
@@ -410,9 +410,9 @@ public class AsyncReverseProxyExample {
System.out.println("[client<-proxy] " + exchangeState.id + " end of output");
}
if (!exchangeState.outputEnd) {
- CapacityChannel capacityChannel = exchangeState.responseCapacityChannel;
+ final CapacityChannel capacityChannel = exchangeState.responseCapacityChannel;
if (capacityChannel != null) {
- int capacity = exchangeState.outBuf.capacity();
+ final int capacity = exchangeState.outBuf.capacity();
if (capacity > 0) {
System.out.println("[proxy->origin] " + exchangeState.id + " input capacity: " + capacity);
capacityChannel.update(capacity);
@@ -475,16 +475,16 @@ public class AsyncReverseProxyExample {
@Override
public void produceRequest(
- final RequestChannel channel, HttpContext httpContext) throws HttpException, IOException {
+ final RequestChannel channel, final HttpContext httpContext) throws HttpException, IOException {
synchronized (exchangeState) {
- HttpRequest incomingRequest = exchangeState.request;
- EntityDetails entityDetails = exchangeState.requestEntityDetails;
- HttpRequest outgoingRequest = new BasicHttpRequest(
+ final HttpRequest incomingRequest = exchangeState.request;
+ final EntityDetails entityDetails = exchangeState.requestEntityDetails;
+ final HttpRequest outgoingRequest = new BasicHttpRequest(
incomingRequest.getMethod(),
targetHost,
incomingRequest.getPath());
- for (Iterator<Header> it = incomingRequest.headerIterator(); it.hasNext(); ) {
- Header header = it.next();
+ for (final Iterator<Header> it = incomingRequest.headerIterator(); it.hasNext(); ) {
+ final Header header = it.next();
if (!HOP_BY_HOP.contains(header.getName().toLowerCase(Locale.ROOT))) {
outgoingRequest.addHeader(header);
}
@@ -500,7 +500,7 @@ public class AsyncReverseProxyExample {
@Override
public int available() {
synchronized (exchangeState) {
- int available = exchangeState.inBuf != null ? exchangeState.inBuf.length() : 0;
+ final int available = exchangeState.inBuf != null ? exchangeState.inBuf.length() : 0;
System.out.println("[proxy->origin] " + exchangeState.id + " output available: " + available);
return available;
}
@@ -513,7 +513,7 @@ public class AsyncReverseProxyExample {
exchangeState.requestDataChannel = channel;
if (exchangeState.inBuf != null) {
if (exchangeState.inBuf.hasData()) {
- int bytesWritten = exchangeState.inBuf.write(channel);
+ final int bytesWritten = exchangeState.inBuf.write(channel);
System.out.println("[proxy->origin] " + exchangeState.id + " " + bytesWritten + " bytes sent");
}
if (exchangeState.inputEnd && !exchangeState.inBuf.hasData()) {
@@ -521,9 +521,9 @@ public class AsyncReverseProxyExample {
System.out.println("[proxy->origin] " + exchangeState.id + " end of output");
}
if (!exchangeState.inputEnd) {
- CapacityChannel capacityChannel = exchangeState.requestCapacityChannel;
+ final CapacityChannel capacityChannel = exchangeState.requestCapacityChannel;
if (capacityChannel != null) {
- int capacity = exchangeState.inBuf.capacity();
+ final int capacity = exchangeState.inBuf.capacity();
if (capacity > 0) {
System.out.println("[client<-proxy] " + exchangeState.id + " input capacity: " + capacity);
capacityChannel.update(capacity);
@@ -535,23 +535,23 @@ public class AsyncReverseProxyExample {
}
@Override
- public void consumeInformation(final HttpResponse response, HttpContext httpContext) throws HttpException, IOException {
+ public void consumeInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
// ignore
}
@Override
public void consumeResponse(
final HttpResponse incomingResponse,
- final EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException {
+ final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
synchronized (exchangeState) {
System.out.println("[proxy<-origin] " + exchangeState.id + " status " + incomingResponse.getCode());
if (entityDetails == null) {
System.out.println("[proxy<-origin] " + exchangeState.id + " end of input");
}
- HttpResponse outgoingResponse = new BasicHttpResponse(incomingResponse.getCode());
- for (Iterator<Header> it = incomingResponse.headerIterator(); it.hasNext(); ) {
- Header header = it.next();
+ final HttpResponse outgoingResponse = new BasicHttpResponse(incomingResponse.getCode());
+ for (final Iterator<Header> it = incomingResponse.headerIterator(); it.hasNext(); ) {
+ final Header header = it.next();
if (!HOP_BY_HOP.contains(header.getName().toLowerCase(Locale.ROOT))) {
outgoingResponse.addHeader(header);
}
@@ -561,7 +561,7 @@ public class AsyncReverseProxyExample {
exchangeState.responseEntityDetails = entityDetails;
exchangeState.outputEnd = entityDetails == null;
- ResponseChannel responseChannel = exchangeState.responseMessageChannel;
+ final ResponseChannel responseChannel = exchangeState.responseMessageChannel;
responseChannel.sendResponse(outgoingResponse, entityDetails, httpContext);
System.out.println("[client<-proxy] " + exchangeState.id + " status " + outgoingResponse.getCode());
@@ -576,7 +576,7 @@ public class AsyncReverseProxyExample {
public void updateCapacity(final CapacityChannel capacityChannel) throws IOException {
synchronized (exchangeState) {
exchangeState.responseCapacityChannel = capacityChannel;
- int capacity = exchangeState.outBuf != null ? exchangeState.outBuf.capacity() : INIT_BUFFER_SIZE;
+ final int capacity = exchangeState.outBuf != null ? exchangeState.outBuf.capacity() : INIT_BUFFER_SIZE;
if (capacity > 0) {
System.out.println("[proxy->origin] " + exchangeState.id + " input capacity: " + capacity);
capacityChannel.update(capacity);
@@ -588,14 +588,14 @@ public class AsyncReverseProxyExample {
public void consume(final ByteBuffer src) throws IOException {
synchronized (exchangeState) {
System.out.println("[proxy<-origin] " + exchangeState.id + " " + src.remaining() + " bytes received");
- DataStreamChannel dataChannel = exchangeState.responseDataChannel;
+ final DataStreamChannel dataChannel = exchangeState.responseDataChannel;
if (dataChannel != null && exchangeState.outBuf != null) {
if (exchangeState.outBuf.hasData()) {
- int bytesWritten = exchangeState.outBuf.write(dataChannel);
+ final int bytesWritten = exchangeState.outBuf.write(dataChannel);
System.out.println("[client<-proxy] " + exchangeState.id + " " + bytesWritten + " bytes sent");
}
if (!exchangeState.outBuf.hasData()) {
- int bytesWritten = dataChannel.write(src);
+ final int bytesWritten = dataChannel.write(src);
System.out.println("[client<-proxy] " + exchangeState.id + " " + bytesWritten + " bytes sent");
}
}
@@ -605,7 +605,7 @@ public class AsyncReverseProxyExample {
}
exchangeState.outBuf.put(src);
}
- int capacity = exchangeState.outBuf != null ? exchangeState.outBuf.capacity() : INIT_BUFFER_SIZE;
+ final int capacity = exchangeState.outBuf != null ? exchangeState.outBuf.capacity() : INIT_BUFFER_SIZE;
System.out.println("[proxy->origin] " + exchangeState.id + " input capacity: " + capacity);
if (dataChannel != null) {
dataChannel.requestOutput();
@@ -618,7 +618,7 @@ public class AsyncReverseProxyExample {
synchronized (exchangeState) {
System.out.println("[proxy<-origin] " + exchangeState.id + " end of input");
exchangeState.outputEnd = true;
- DataStreamChannel dataChannel = exchangeState.responseDataChannel;
+ final DataStreamChannel dataChannel = exchangeState.responseDataChannel;
if (dataChannel != null && (exchangeState.outBuf == null || !exchangeState.outBuf.hasData())) {
System.out.println("[client<-proxy] " + exchangeState.id + " end of output");
dataChannel.endStream();
@@ -640,13 +640,13 @@ public class AsyncReverseProxyExample {
}
synchronized (exchangeState) {
if (exchangeState.response == null) {
- int status = cause instanceof IOException ? HttpStatus.SC_SERVICE_UNAVAILABLE : HttpStatus.SC_INTERNAL_SERVER_ERROR;
- HttpResponse outgoingResponse = new BasicHttpResponse(status);
+ final int status = cause instanceof IOException ? HttpStatus.SC_SERVICE_UNAVAILABLE : HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ final HttpResponse outgoingResponse = new BasicHttpResponse(status);
outgoingResponse.addHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
exchangeState.response = outgoingResponse;
- ByteBuffer msg = StandardCharsets.US_ASCII.encode(CharBuffer.wrap(cause.getMessage()));
- int contentLen = msg.remaining();
+ final ByteBuffer msg = StandardCharsets.US_ASCII.encode(CharBuffer.wrap(cause.getMessage()));
+ final int contentLen = msg.remaining();
exchangeState.outBuf = new ProxyBuffer(1024);
exchangeState.outBuf.put(msg);
exchangeState.outputEnd = true;
@@ -654,7 +654,7 @@ public class AsyncReverseProxyExample {
System.out.println("[client<-proxy] " + exchangeState.id + " status " + outgoingResponse.getCode());
try {
- EntityDetails entityDetails = new BasicEntityDetails(contentLen, ContentType.TEXT_PLAIN);
+ final EntityDetails entityDetails = new BasicEntityDetails(contentLen, ContentType.TEXT_PLAIN);
exchangeState.responseMessageChannel.sendResponse(outgoingResponse, entityDetails, null);
} catch (HttpException | IOException ignore) {
// ignore
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
index 7c49081..749f51d 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
@@ -66,13 +66,13 @@ import org.apache.hc.core5.util.TimeValue;
*/
public class AsyncServerFilterExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
int port = 8080;
if (args.length >= 1) {
port = Integer.parseInt(args[0]);
}
- IOReactorConfig config = IOReactorConfig.custom()
+ final IOReactorConfig config = IOReactorConfig.custom()
.setSoTimeout(15, TimeUnit.SECONDS)
.setTcpNoDelay(true)
.build();
@@ -187,8 +187,8 @@ public class AsyncServerFilterExample {
});
server.start();
- Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
- ListenerEndpoint listenerEndpoint = future.get();
+ final Future<ListenerEndpoint> future = server.listen(new InetSocketAddress(port));
+ final ListenerEndpoint listenerEndpoint = future.get();
System.out.print("Listening on " + listenerEndpoint.getAddress());
server.awaitShutdown(TimeValue.ofDays(Long.MAX_VALUE));
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
index f0f254e..bcb7457 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicFileServerExample.java
@@ -67,13 +67,13 @@ import org.apache.hc.core5.util.TimeValue;
*/
public class ClassicFileServerExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Please specify document root directory");
System.exit(1);
}
// Document root directory
- String docRoot = args[0];
+ final String docRoot = args[0];
int port = 8080;
if (args.length >= 2) {
port = Integer.parseInt(args[1]);
@@ -82,7 +82,7 @@ public class ClassicFileServerExample {
SSLContext sslContext = null;
if (port == 8443) {
// Initialize SSL context
- URL url = ClassicFileServerExample.class.getResource("/my.keystore");
+ final URL url = ClassicFileServerExample.class.getResource("/my.keystore");
if (url == null) {
System.out.println("Keystore not found");
System.exit(1);
@@ -92,7 +92,7 @@ public class ClassicFileServerExample {
.build();
}
- SocketConfig socketConfig = SocketConfig.custom()
+ final SocketConfig socketConfig = SocketConfig.custom()
.setSoTimeout(15, TimeUnit.SECONDS)
.setTcpNoDelay(true)
.build();
@@ -151,15 +151,15 @@ public class ClassicFileServerExample {
final ClassicHttpResponse response,
final HttpContext context) throws HttpException, IOException {
- String method = request.getMethod().toUpperCase(Locale.ROOT);
+ final String method = request.getMethod().toUpperCase(Locale.ROOT);
if (!method.equals("GET") && !method.equals("HEAD") && !method.equals("POST")) {
throw new MethodNotSupportedException(method + " method not supported");
}
- String path = request.getPath();
+ final String path = request.getPath();
- HttpEntity incomingEntity = request.getEntity();
+ final HttpEntity incomingEntity = request.getEntity();
if (incomingEntity != null) {
- byte[] entityContent = EntityUtils.toByteArray(incomingEntity);
+ final byte[] entityContent = EntityUtils.toByteArray(incomingEntity);
System.out.println("Incoming incomingEntity content (bytes): " + entityContent.length);
}
@@ -167,7 +167,7 @@ public class ClassicFileServerExample {
if (!file.exists()) {
response.setCode(HttpStatus.SC_NOT_FOUND);
- StringEntity outgoingEntity = new StringEntity(
+ final StringEntity outgoingEntity = new StringEntity(
"<html><body><h1>File " + file.getPath() +
" not found</h1></body></html>",
ContentType.create("text/html", "UTF-8"));
@@ -177,17 +177,17 @@ public class ClassicFileServerExample {
} else if (!file.canRead() || file.isDirectory()) {
response.setCode(HttpStatus.SC_FORBIDDEN);
- StringEntity outgoingEntity = new StringEntity(
+ final StringEntity outgoingEntity = new StringEntity(
"<html><body><h1>Access denied</h1></body></html>",
ContentType.create("text/html", "UTF-8"));
response.setEntity(outgoingEntity);
System.out.println("Cannot read file " + file.getPath());
} else {
- HttpCoreContext coreContext = HttpCoreContext.adapt(context);
- EndpointDetails endpoint = coreContext.getEndpointDetails();
+ final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
+ final EndpointDetails endpoint = coreContext.getEndpointDetails();
response.setCode(HttpStatus.SC_OK);
- FileEntity body = new FileEntity(file, ContentType.create("text/html", (Charset) null));
+ final FileEntity body = new FileEntity(file, ContentType.create("text/html", (Charset) null));
response.setEntity(body);
System.out.println(endpoint + ": serving file " + file.getPath());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
index 0fd5f0d..d605091 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicGetExecutionExample.java
@@ -51,8 +51,8 @@ import org.apache.hc.core5.util.Timeout;
*/
public class ClassicGetExecutionExample {
- public static void main(String[] args) throws Exception {
- HttpRequester httpRequester = RequesterBootstrap.bootstrap()
+ public static void main(final String[] args) throws Exception {
+ final HttpRequester httpRequester = RequesterBootstrap.bootstrap()
.setStreamListener(new Http1StreamListener() {
@Override
@@ -81,13 +81,13 @@ public class ClassicGetExecutionExample {
.build())
.create();
- HttpCoreContext coreContext = HttpCoreContext.create();
- HttpHost target = new HttpHost("httpbin.org");
- String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
+ final HttpCoreContext coreContext = HttpCoreContext.create();
+ final HttpHost target = new HttpHost("httpbin.org");
+ final String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
for (int i = 0; i < requestUris.length; i++) {
- String requestUri = requestUris[i];
- ClassicHttpRequest request = new BasicClassicHttpRequest("GET", target, requestUri);
+ final String requestUri = requestUris[i];
+ final ClassicHttpRequest request = new BasicClassicHttpRequest("GET", target, requestUri);
try (ClassicHttpResponse response = httpRequester.execute(target, request, Timeout.ofSeconds(5), coreContext)) {
System.out.println(requestUri + "->" + response.getCode());
System.out.println(EntityUtils.toString(response.getEntity()));
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
index 6c1a0ad..718d835 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostExecutionExample.java
@@ -58,8 +58,8 @@ import org.apache.hc.core5.util.Timeout;
*/
public class ClassicPostExecutionExample {
- public static void main(String[] args) throws Exception {
- HttpRequester httpRequester = RequesterBootstrap.bootstrap()
+ public static void main(final String[] args) throws Exception {
+ final HttpRequester httpRequester = RequesterBootstrap.bootstrap()
.setStreamListener(new Http1StreamListener() {
@Override
@@ -87,10 +87,10 @@ public class ClassicPostExecutionExample {
.setSoTimeout(5, TimeUnit.SECONDS)
.build())
.create();
- HttpCoreContext coreContext = HttpCoreContext.create();
- HttpHost target = new HttpHost("httpbin.org");
+ final HttpCoreContext coreContext = HttpCoreContext.create();
+ final HttpHost target = new HttpHost("httpbin.org");
- HttpEntity[] requestBodies = {
+ final HttpEntity[] requestBodies = {
new StringEntity(
"This is the first test request",
ContentType.create("text/plain", StandardCharsets.UTF_8)),
@@ -104,9 +104,9 @@ public class ClassicPostExecutionExample {
ContentType.APPLICATION_OCTET_STREAM)
};
- String requestUri = "/post";
+ final String requestUri = "/post";
for (int i = 0; i < requestBodies.length; i++) {
- ClassicHttpRequest request = new BasicClassicHttpRequest("POST", target,requestUri);
+ final ClassicHttpRequest request = new BasicClassicHttpRequest("POST", target,requestUri);
request.setEntity(requestBodies[i]);
try (ClassicHttpResponse response = httpRequester.execute(target, request, Timeout.ofSeconds(5), coreContext)) {
System.out.println(requestUri + "->" + response.getCode());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
index 1d83848..73a31c4 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicPostWithTrailersExecutionExample.java
@@ -49,19 +49,19 @@ import org.apache.hc.core5.util.Timeout;
* Example of POST request with trailers execution using classic I/O.
*/
public class ClassicPostWithTrailersExecutionExample {
- public static void main(String[] args) throws Exception {
- HttpRequester httpRequester = RequesterBootstrap.bootstrap()
+ public static void main(final String[] args) throws Exception {
+ final HttpRequester httpRequester = RequesterBootstrap.bootstrap()
.setSocketConfig(SocketConfig.custom()
.setSoTimeout(5, TimeUnit.SECONDS)
.build())
.create();
- HttpCoreContext coreContext = HttpCoreContext.create();
- HttpHost target = new HttpHost("httpbin.org");
+ final HttpCoreContext coreContext = HttpCoreContext.create();
+ final HttpHost target = new HttpHost("httpbin.org");
- String requestUri = "/post";
- ClassicHttpRequest request = new BasicClassicHttpRequest("POST", target, requestUri);
- HttpEntity requestBody = new HttpEntityWithTrailers(
+ final String requestUri = "/post";
+ final ClassicHttpRequest request = new BasicClassicHttpRequest("POST", target, requestUri);
+ final HttpEntity requestBody = new HttpEntityWithTrailers(
new StringEntity("Chunked message with trailers", ContentType.TEXT_PLAIN),
new BasicHeader("t1","Hello world"));
request.setEntity(requestBody);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java
index 8ebf618..686496b 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicReverseProxyExample.java
@@ -107,16 +107,16 @@ public class ClassicReverseProxyExample {
@Override
public void onLease(final HttpHost route, final ConnPoolStats<HttpHost> connPoolStats) {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("[proxy->origin] " + Thread.currentThread() + " connection leased ").append(route);
System.out.println(buf.toString());
}
@Override
public void onRelease(final HttpHost route, final ConnPoolStats<HttpHost> connPoolStats) {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("[proxy->origin] " + Thread.currentThread() + " connection released ").append(route);
- PoolStats totals = connPoolStats.getTotalStats();
+ final PoolStats totals = connPoolStats.getTotalStats();
buf.append("; total kept alive: ").append(totals.getAvailable()).append("; ");
buf.append("total allocated: ").append(totals.getLeased() + totals.getAvailable());
buf.append(" of ").append(totals.getMax());
@@ -225,8 +225,8 @@ public class ClassicReverseProxyExample {
incomingRequest.getMethod(),
targetHost,
incomingRequest.getPath());
- for (Iterator<Header> it = incomingRequest.headerIterator(); it.hasNext(); ) {
- Header header = it.next();
+ for (final Iterator<Header> it = incomingRequest.headerIterator(); it.hasNext(); ) {
+ final Header header = it.next();
if (!HOP_BY_HOP.contains(header.getName().toLowerCase(Locale.ROOT))) {
outgoingRequest.addHeader(header);
}
@@ -235,8 +235,8 @@ public class ClassicReverseProxyExample {
final ClassicHttpResponse incomingResponse = requester.execute(
targetHost, outgoingRequest, Timeout.ofMinutes(1), clientContext);
outgoingResponse.setCode(incomingResponse.getCode());
- for (Iterator<Header> it = incomingResponse.headerIterator(); it.hasNext(); ) {
- Header header = it.next();
+ for (final Iterator<Header> it = incomingResponse.headerIterator(); it.hasNext(); ) {
+ final Header header = it.next();
if (!HOP_BY_HOP.contains(header.getName().toLowerCase(Locale.ROOT))) {
outgoingResponse.addHeader(header);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
index e0c4a50..cc14173 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
@@ -55,12 +55,12 @@ import org.apache.hc.core5.util.TimeValue;
*/
public class ClassicServerFilterExample {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
int port = 8080;
if (args.length >= 1) {
port = Integer.parseInt(args[0]);
}
- SocketConfig socketConfig = SocketConfig.custom()
+ final SocketConfig socketConfig = SocketConfig.custom()
.setSoTimeout(15, TimeUnit.SECONDS)
.setTcpNoDelay(true)
.build();
@@ -106,7 +106,7 @@ public class ClassicServerFilterExample {
@Override
public void handle(final ClassicHttpRequest request,
final HttpFilterChain.ResponseTrigger responseTrigger,
- final HttpContext context, HttpFilterChain chain) throws HttpException, IOException {
+ final HttpContext context, final HttpFilterChain chain) throws HttpException, IOException {
if (request.getRequestUri().equals("/back-door")) {
final ClassicHttpResponse response = new BasicClassicHttpResponse(HttpStatus.SC_OK);
response.setEntity(new StringEntity("Welcome", ContentType.TEXT_PLAIN));
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/924542bb/httpcore5/src/examples/org/apache/hc/core5/http/examples/PrintVersionInfo.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/PrintVersionInfo.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/PrintVersionInfo.java
index 6f37c72..85f1a6e 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/PrintVersionInfo.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/PrintVersionInfo.java
@@ -52,8 +52,8 @@ public class PrintVersionInfo {
* information for the default packages. Otherwise, pass
* a list of packages for which to get version info.
*/
- public static void main(String args[]) {
- String[] pckgs = (args.length > 0) ? args : MODULE_LIST;
+ public static void main(final String args[]) {
+ final String[] pckgs = (args.length > 0) ? args : MODULE_LIST;
VersionInfo[] via = VersionInfo.loadVersionInfo(pckgs, null);
System.out.println("version info for thread context classloader:");
for (int i=0; i<via.length; i++)