You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/08/14 19:01:27 UTC
[3/3] httpcomponents-client git commit: - Always use blocks - Add
missing serial version ID (default 1L) - Camel-case names. - Don't nest in
else clause unnecessarily. - Remove declared exceptions that are not thrown
(but don't break BC.) - Remove redund
- Always use blocks
- Add missing serial version ID (default 1L)
- Camel-case names.
- Don't nest in else clause unnecessarily.
- Remove declared exceptions that are not thrown (but don't break BC.)
- Remove redundant superinterface
- Access static methods directly
- Better local var names.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/e6c226d5
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/e6c226d5
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/e6c226d5
Branch: refs/heads/4.5.x
Commit: e6c226d5f6f34db4bd86aa81168289ac81a0896a
Parents: b9a286e
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Aug 13 16:47:47 2018 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Aug 14 20:54:41 2018 +0200
----------------------------------------------------------------------
.../client/fluent/InternalByteArrayEntity.java | 8 +--
.../http/client/fluent/InternalFileEntity.java | 14 +++---
.../fluent/InternalInputStreamEntity.java | 26 +++++-----
.../org/apache/http/client/fluent/Request.java | 8 +--
.../http/client/cache/ResourceFactory.java | 4 +-
.../http/impl/client/cache/CacheEntity.java | 10 ++--
.../http/impl/client/cache/CombinedEntity.java | 16 +++---
.../impl/client/cache/FileResourceFactory.java | 10 ++--
.../impl/client/cache/HeapResourceFactory.java | 16 +++---
.../apache/http/impl/client/cache/IOUtils.java | 6 +--
.../client/cache/SizeLimitedResponseReader.java | 10 ++--
.../impl/client/cache/TestCombinedEntity.java | 4 +-
.../client/ClientConnectionRelease.java | 6 +--
.../apache/http/conn/BasicManagedEntity.java | 4 +-
.../impl/conn/BasicClientConnectionManager.java | 14 +++---
.../http/impl/conn/DefaultClientConnection.java | 16 +++---
.../org/apache/http/impl/conn/HttpConnPool.java | 8 +--
.../apache/http/impl/conn/HttpPoolEntry.java | 4 +-
.../impl/conn/LoggingSessionInputBuffer.java | 34 ++++++-------
.../conn/PoolingClientConnectionManager.java | 28 +++++------
.../http/impl/conn/SingleClientConnManager.java | 8 +--
.../http/impl/conn/tsccm/AbstractConnPool.java | 14 +++---
.../http/impl/conn/tsccm/ConnPoolByRoute.java | 20 ++++----
.../http/impl/conn/tsccm/PoolEntryRequest.java | 4 +-
.../conn/tsccm/ThreadSafeClientConnManager.java | 10 ++--
.../apache/http/auth/AuthSchemeRegistry.java | 3 +-
.../http/client/entity/DecompressingEntity.java | 15 +++---
.../client/entity/GzipCompressingEntity.java | 6 +--
.../http/client/entity/InputStreamFactory.java | 2 +-
.../http/client/methods/HttpRequestWrapper.java | 9 ++--
.../http/client/protocol/HttpClientContext.java | 8 ++-
.../apache/http/client/utils/CloneUtils.java | 6 +--
.../apache/http/client/utils/URIBuilder.java | 8 ++-
.../org/apache/http/client/utils/URIUtils.java | 18 ++-----
.../http/client/utils/URLEncodedUtils.java | 8 +--
.../http/conn/ClientConnectionManager.java | 4 +-
.../http/conn/ClientConnectionRequest.java | 4 +-
.../org/apache/http/conn/ConnectionRequest.java | 4 +-
.../apache/http/conn/EofSensorInputStream.java | 16 +++---
.../http/conn/HttpClientConnectionManager.java | 4 +-
.../http/conn/ManagedClientConnection.java | 3 +-
.../org/apache/http/conn/routing/HttpRoute.java | 24 +++------
.../org/apache/http/conn/scheme/Scheme.java | 14 ++----
.../conn/scheme/SchemeSocketFactoryAdaptor.java | 8 ++-
.../http/conn/scheme/SocketFactoryAdaptor.java | 8 ++-
.../apache/http/conn/ssl/AbstractVerifier.java | 3 +-
.../conn/ssl/SSLConnectionSocketFactory.java | 3 +-
.../http/conn/util/PublicSuffixMatcher.java | 6 +--
.../apache/http/cookie/CookieSpecRegistry.java | 3 +-
.../apache/http/impl/auth/AuthSchemeBase.java | 6 +--
.../org/apache/http/impl/auth/DigestScheme.java | 6 +--
.../apache/http/impl/auth/GGSSchemeBase.java | 8 ++-
.../http/impl/auth/HttpAuthenticator.java | 52 +++++++++-----------
.../apache/http/impl/auth/NTLMEngineImpl.java | 30 ++++++-----
.../apache/http/impl/client/BasicAuthCache.java | 6 +--
.../client/DefaultHttpRequestRetryHandler.java | 9 ++--
.../impl/client/DefaultRedirectStrategy.java | 8 ++-
.../client/EntityEnclosingRequestWrapper.java | 4 +-
.../http/impl/client/HttpRequestFutureTask.java | 9 ++--
.../impl/client/HttpRequestTaskCallable.java | 3 +-
.../http/impl/client/IdleConnectionEvictor.java | 4 +-
.../http/impl/client/InternalHttpClient.java | 4 +-
.../http/impl/client/MinimalHttpClient.java | 4 +-
.../SystemDefaultCredentialsProvider.java | 18 +++----
.../conn/BasicHttpClientConnectionManager.java | 14 +++---
.../java/org/apache/http/impl/conn/CPool.java | 8 +--
.../org/apache/http/impl/conn/CPoolEntry.java | 4 +-
.../org/apache/http/impl/conn/CPoolProxy.java | 24 ++-------
.../DefaultHttpClientConnectionOperator.java | 8 ++-
.../DefaultManagedHttpClientConnection.java | 18 +++----
.../http/impl/conn/DefaultRoutePlanner.java | 8 ++-
.../LoggingManagedHttpClientConnection.java | 30 +++++------
.../ManagedHttpClientConnectionFactory.java | 28 +++++------
.../PoolingHttpClientConnectionManager.java | 30 +++++------
.../java/org/apache/http/impl/conn/Wire.java | 16 +++---
.../http/impl/cookie/DefaultCookieSpec.java | 51 ++++++++-----------
.../http/impl/cookie/LaxExpiresHandler.java | 5 +-
.../apache/http/impl/cookie/RFC2109Spec.java | 6 +--
.../apache/http/impl/cookie/RFC2965Spec.java | 20 +++-----
.../http/impl/execchain/ConnectionHolder.java | 8 +--
.../http/impl/execchain/RequestEntityProxy.java | 4 +-
.../impl/execchain/ResponseEntityProxy.java | 6 +--
.../org/apache/http/auth/TestCredentials.java | 24 ++++-----
.../client/entity/TestDecompressingEntity.java | 4 +-
.../org/apache/http/client/entity/TestGZip.java | 3 +-
.../client/methods/TestHttpRequestBase.java | 4 +-
.../client/protocol/TestRequestAddCookies.java | 3 +-
.../http/client/utils/TestHttpClientUtils.java | 24 ++++-----
.../http/conn/TestEofSensorInputStream.java | 46 ++++++++---------
.../http/impl/client/MockConnPoolControl.java | 6 +--
.../client/TestAbstractResponseHandler.java | 6 +--
.../http/impl/client/TestBasicCookieStore.java | 28 +++++------
.../impl/client/TestBasicResponseHandler.java | 6 +--
.../impl/client/TestIdleConnectionEvictor.java | 3 +-
.../client/integration/TestAbortHandling.java | 15 +++---
.../integration/TestConnectionAutoRelease.java | 6 +--
.../TestMalformedServerResponse.java | 4 +-
.../http/impl/conn/SessionInputBufferMock.java | 26 +++++-----
.../conn/TestDefaultHttpResponseParser.java | 16 +++---
.../http/impl/cookie/TestBasicClientCookie.java | 12 ++---
.../impl/cookie/TestBasicClientCookie2.java | 12 ++---
.../http/impl/cookie/TestRFC6265CookieSpec.java | 13 ++---
.../http/impl/execchain/TestMainClientExec.java | 42 ++++++++--------
.../http/impl/execchain/TestRedirectExec.java | 18 +++----
.../execchain/TestResponseEntityWrapper.java | 30 +++++------
.../http/entity/mime/MultipartEntity.java | 4 +-
.../http/entity/mime/MultipartFormEntity.java | 12 ++---
107 files changed, 599 insertions(+), 716 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java
----------------------------------------------------------------------
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java
index b2702d1..986095f 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java
@@ -91,10 +91,10 @@ class InternalByteArrayEntity extends AbstractHttpEntity implements Cloneable {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- outstream.write(this.b, this.off, this.len);
- outstream.flush();
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ outStream.write(this.b, this.off, this.len);
+ outStream.flush();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
----------------------------------------------------------------------
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
index 39c2b44..6681e5a 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
@@ -65,18 +65,18 @@ class InternalFileEntity extends AbstractHttpEntity implements Cloneable {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = new FileInputStream(this.file);
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = new FileInputStream(this.file);
try {
final byte[] tmp = new byte[4096];
int l;
- while ((l = instream.read(tmp)) != -1) {
- outstream.write(tmp, 0, l);
+ while ((l = inStream.read(tmp)) != -1) {
+ outStream.write(tmp, 0, l);
}
- outstream.flush();
+ outStream.flush();
} finally {
- instream.close();
+ inStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
----------------------------------------------------------------------
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
index 3a47041..701277a 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
@@ -40,9 +40,9 @@ class InternalInputStreamEntity extends AbstractHttpEntity {
private final InputStream content;
private final long length;
- public InternalInputStreamEntity(final InputStream instream, final long length, final ContentType contentType) {
+ public InternalInputStreamEntity(final InputStream inputStream, final long length, final ContentType contentType) {
super();
- this.content = Args.notNull(instream, "Source input stream");
+ this.content = Args.notNull(inputStream, "Source input stream");
this.length = length;
if (contentType != null) {
setContentType(contentType.toString());
@@ -65,31 +65,31 @@ class InternalInputStreamEntity extends AbstractHttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = this.content;
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = this.content;
try {
final byte[] buffer = new byte[4096];
- int l;
+ int readLen;
if (this.length < 0) {
// consume until EOF
- while ((l = instream.read(buffer)) != -1) {
- outstream.write(buffer, 0, l);
+ while ((readLen = inStream.read(buffer)) != -1) {
+ outStream.write(buffer, 0, readLen);
}
} else {
// consume no more than length
long remaining = this.length;
while (remaining > 0) {
- l = instream.read(buffer, 0, (int)Math.min(4096, remaining));
- if (l == -1) {
+ readLen = inStream.read(buffer, 0, (int)Math.min(4096, remaining));
+ if (readLen == -1) {
break;
}
- outstream.write(buffer, 0, l);
- remaining -= l;
+ outStream.write(buffer, 0, readLen);
+ remaining -= readLen;
}
}
} finally {
- instream.close();
+ inStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
----------------------------------------------------------------------
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
index 4c43f59..4d21166 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
@@ -401,12 +401,12 @@ public class Request {
return body(new InternalByteArrayEntity(b, off, len, contentType));
}
- public Request bodyStream(final InputStream instream) {
- return body(new InternalInputStreamEntity(instream, -1, null));
+ public Request bodyStream(final InputStream inStream) {
+ return body(new InternalInputStreamEntity(inStream, -1, null));
}
- public Request bodyStream(final InputStream instream, final ContentType contentType) {
- return body(new InternalInputStreamEntity(instream, -1, contentType));
+ public Request bodyStream(final InputStream inStream, final ContentType contentType) {
+ return body(new InternalInputStreamEntity(inStream, -1, contentType));
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/main/java/org/apache/http/client/cache/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/ResourceFactory.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/ResourceFactory.java
index 0966479..96a7225 100644
--- a/httpclient-cache/src/main/java/org/apache/http/client/cache/ResourceFactory.java
+++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/ResourceFactory.java
@@ -41,7 +41,7 @@ public interface ResourceFactory {
* Creates a {@link Resource} from a given response body.
* @param requestId a unique identifier for this particular
* response body
- * @param instream the original {@link InputStream}
+ * @param inStream the original {@link InputStream}
* containing the response body of the origin HTTP response.
* @param limit maximum number of bytes to consume of the
* response body; if this limit is reached before the
@@ -52,7 +52,7 @@ public interface ResourceFactory {
* the response body was successfully read.
* @throws IOException
*/
- Resource generate(String requestId, InputStream instream, InputLimit limit) throws IOException;
+ Resource generate(String requestId, InputStream inStream, InputLimit limit) throws IOException;
/**
* Clones an existing {@link Resource}.
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
index 529d698..9a9bb04 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
@@ -82,13 +82,13 @@ class CacheEntity implements HttpEntity, Serializable {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = this.cacheEntry.getResource().getInputStream();
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = this.cacheEntry.getResource().getInputStream();
try {
- IOUtils.copy(instream, outstream);
+ IOUtils.copy(inStream, outStream);
} finally {
- instream.close();
+ inStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java
index c665339..2a8f5fa 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java
@@ -41,11 +41,11 @@ class CombinedEntity extends AbstractHttpEntity {
private final Resource resource;
private final InputStream combinedStream;
- CombinedEntity(final Resource resource, final InputStream instream) throws IOException {
+ CombinedEntity(final Resource resource, final InputStream inStream) throws IOException {
super();
this.resource = resource;
this.combinedStream = new SequenceInputStream(
- new ResourceStream(resource.getInputStream()), instream);
+ new ResourceStream(resource.getInputStream()), inStream);
}
@Override
@@ -69,17 +69,17 @@ class CombinedEntity extends AbstractHttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = getContent();
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = getContent();
try {
int l;
final byte[] tmp = new byte[2048];
- while ((l = instream.read(tmp)) != -1) {
- outstream.write(tmp, 0, l);
+ while ((l = inStream.read(tmp)) != -1) {
+ outStream.write(tmp, 0, l);
}
} finally {
- instream.close();
+ inStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
index b530eab..b4bdbb6 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
@@ -73,16 +73,16 @@ public class FileResourceFactory implements ResourceFactory {
@Override
public Resource generate(
final String requestId,
- final InputStream instream,
+ final InputStream inStream,
final InputLimit limit) throws IOException {
final File file = generateUniqueCacheFile(requestId);
- final FileOutputStream outstream = new FileOutputStream(file);
+ final FileOutputStream outStream = new FileOutputStream(file);
try {
final byte[] buf = new byte[2048];
long total = 0;
int l;
- while ((l = instream.read(buf)) != -1) {
- outstream.write(buf, 0, l);
+ while ((l = inStream.read(buf)) != -1) {
+ outStream.write(buf, 0, l);
total += l;
if (limit != null && total > limit.getValue()) {
limit.reached();
@@ -90,7 +90,7 @@ public class FileResourceFactory implements ResourceFactory {
}
}
} finally {
- outstream.close();
+ outStream.close();
}
return new FileResource(file);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java
index 8cb9a2d..e00526e 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java
@@ -47,21 +47,21 @@ public class HeapResourceFactory implements ResourceFactory {
@Override
public Resource generate(
final String requestId,
- final InputStream instream,
+ final InputStream inStream,
final InputLimit limit) throws IOException {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
final byte[] buf = new byte[2048];
long total = 0;
int l;
- while ((l = instream.read(buf)) != -1) {
- outstream.write(buf, 0, l);
+ while ((l = inStream.read(buf)) != -1) {
+ outStream.write(buf, 0, l);
total += l;
if (limit != null && total > limit.getValue()) {
limit.reached();
break;
}
}
- return createResource(outstream.toByteArray());
+ return createResource(outStream.toByteArray());
}
@Override
@@ -72,9 +72,9 @@ public class HeapResourceFactory implements ResourceFactory {
if (resource instanceof HeapResource) {
body = ((HeapResource) resource).getByteArray();
} else {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- IOUtils.copyAndClose(resource.getInputStream(), outstream);
- body = outstream.toByteArray();
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ IOUtils.copyAndClose(resource.getInputStream(), outStream);
+ body = outStream.toByteArray();
}
return createResource(body);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
index 229bce6..f4d6325 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
@@ -43,9 +43,9 @@ class IOUtils {
return;
}
if (entity.isStreaming()) {
- final InputStream instream = entity.getContent();
- if (instream != null) {
- instream.close();
+ final InputStream inStream = entity.getContent();
+ if (inStream != null) {
+ inStream.close();
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/SizeLimitedResponseReader.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/SizeLimitedResponseReader.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/SizeLimitedResponseReader.java
index f02e608..d7749ef 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/SizeLimitedResponseReader.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/SizeLimitedResponseReader.java
@@ -49,7 +49,7 @@ class SizeLimitedResponseReader {
private final HttpRequest request;
private final CloseableHttpResponse response;
- private InputStream instream;
+ private InputStream inStream;
private InputLimit limit;
private Resource resource;
private boolean consumed;
@@ -99,12 +99,12 @@ class SizeLimitedResponseReader {
return;
}
final String uri = request.getRequestLine().getUri();
- instream = entity.getContent();
+ inStream = entity.getContent();
try {
- resource = resourceFactory.generate(uri, instream, limit);
+ resource = resourceFactory.generate(uri, inStream, limit);
} finally {
if (!limit.isReached()) {
- instream.close();
+ inStream.close();
}
}
}
@@ -124,7 +124,7 @@ class SizeLimitedResponseReader {
final HttpResponse reconstructed = new BasicHttpResponse(response.getStatusLine());
reconstructed.setHeaders(response.getAllHeaders());
- final CombinedEntity combinedEntity = new CombinedEntity(resource, instream);
+ final CombinedEntity combinedEntity = new CombinedEntity(resource, inStream);
final HttpEntity entity = response.getEntity();
if (entity != null) {
combinedEntity.setContentType(entity.getContentType());
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCombinedEntity.java
----------------------------------------------------------------------
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCombinedEntity.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCombinedEntity.java
index 2e728bd..b58ab63 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCombinedEntity.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCombinedEntity.java
@@ -45,8 +45,8 @@ public class TestCombinedEntity {
when(resource.getInputStream()).thenReturn(
new ByteArrayInputStream(new byte[] { 1, 2, 3, 4, 5 }));
- final ByteArrayInputStream instream = new ByteArrayInputStream(new byte[] { 6, 7, 8, 9, 10 });
- final CombinedEntity entity = new CombinedEntity(resource, instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(new byte[] { 6, 7, 8, 9, 10 });
+ final CombinedEntity entity = new CombinedEntity(resource, inStream);
Assert.assertEquals(-1, entity.getContentLength());
Assert.assertFalse(entity.isRepeatable());
Assert.assertTrue(entity.isStreaming());
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
----------------------------------------------------------------------
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java b/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
index 65ee4bf..39b4c5d 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
@@ -59,9 +59,9 @@ public class ClientConnectionRelease {
// If the response does not enclose an entity, there is no need
// to bother about connection release
if (entity != null) {
- InputStream instream = entity.getContent();
+ InputStream inStream = entity.getContent();
try {
- instream.read();
+ inStream.read();
// do something useful with the response
} catch (IOException ex) {
// In case of an IOException the connection will be released
@@ -69,7 +69,7 @@ public class ClientConnectionRelease {
throw ex;
} finally {
// Closing the input stream will trigger connection release
- instream.close();
+ inStream.close();
}
}
} finally {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/conn/BasicManagedEntity.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/BasicManagedEntity.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/BasicManagedEntity.java
index 93765e7..6f5fc89 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/BasicManagedEntity.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/BasicManagedEntity.java
@@ -113,8 +113,8 @@ public class BasicManagedEntity extends HttpEntityWrapper
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- super.writeTo(outstream);
+ public void writeTo(final OutputStream outStream) throws IOException {
+ super.writeTo(outStream);
ensureConsumed();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java
index 3e158ab..4a70eff 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java
@@ -141,7 +141,7 @@ public class BasicClientConnectionManager implements ClientConnectionManager {
@Override
public ManagedClientConnection getConnection(
- final long timeout, final TimeUnit tunit) {
+ final long timeout, final TimeUnit timeUnit) {
return BasicClientConnectionManager.this.getConnection(
route, state);
}
@@ -191,7 +191,7 @@ public class BasicClientConnectionManager implements ClientConnectionManager {
}
@Override
- public void releaseConnection(final ManagedClientConnection conn, final long keepalive, final TimeUnit tunit) {
+ public void releaseConnection(final ManagedClientConnection conn, final long keepalive, final TimeUnit timeUnit) {
Args.check(conn instanceof ManagedClientConnectionImpl, "Connection class mismatch, " +
"connection not obtained from this manager");
final ManagedClientConnectionImpl managedConn = (ManagedClientConnectionImpl) conn;
@@ -214,11 +214,11 @@ public class BasicClientConnectionManager implements ClientConnectionManager {
shutdownConnection(managedConn);
}
if (managedConn.isMarkedReusable()) {
- this.poolEntry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS);
+ this.poolEntry.updateExpiry(keepalive, timeUnit != null ? timeUnit : TimeUnit.MILLISECONDS);
if (this.log.isDebugEnabled()) {
final String s;
if (keepalive > 0) {
- s = "for " + keepalive + " " + tunit;
+ s = "for " + keepalive + " " + timeUnit;
} else {
s = "indefinitely";
}
@@ -249,11 +249,11 @@ public class BasicClientConnectionManager implements ClientConnectionManager {
}
@Override
- public void closeIdleConnections(final long idletime, final TimeUnit tunit) {
- Args.notNull(tunit, "Time unit");
+ public void closeIdleConnections(final long idletime, final TimeUnit timeUnit) {
+ Args.notNull(timeUnit, "Time unit");
synchronized (this) {
assertNotShutdown();
- long time = tunit.toMillis(idletime);
+ long time = timeUnit.toMillis(idletime);
if (time < 0) {
time = 0;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnection.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnection.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnection.java
index 081f067..027a1f2 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnection.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnection.java
@@ -187,29 +187,29 @@ public class DefaultClientConnection extends SocketHttpClientConnection
@Override
protected SessionInputBuffer createSessionInputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- SessionInputBuffer inbuffer = super.createSessionInputBuffer(
+ SessionInputBuffer inBuffer = super.createSessionInputBuffer(
socket,
- buffersize > 0 ? buffersize : 8192,
+ bufferSize > 0 ? bufferSize : 8192,
params);
if (wireLog.isDebugEnabled()) {
- inbuffer = new LoggingSessionInputBuffer(
- inbuffer,
+ inBuffer = new LoggingSessionInputBuffer(
+ inBuffer,
new Wire(wireLog),
HttpProtocolParams.getHttpElementCharset(params));
}
- return inbuffer;
+ return inBuffer;
}
@Override
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
SessionOutputBuffer outbuffer = super.createSessionOutputBuffer(
socket,
- buffersize > 0 ? buffersize : 8192,
+ bufferSize > 0 ? bufferSize : 8192,
params);
if (wireLog.isDebugEnabled()) {
outbuffer = new LoggingSessionOutputBuffer(
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpConnPool.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpConnPool.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpConnPool.java
index c89dbe4..f9bf401 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpConnPool.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpConnPool.java
@@ -49,22 +49,22 @@ class HttpConnPool extends AbstractConnPool<HttpRoute, OperatedClientConnection,
private final Log log;
private final long timeToLive;
- private final TimeUnit tunit;
+ private final TimeUnit timeUnit;
public HttpConnPool(final Log log,
final ClientConnectionOperator connOperator,
final int defaultMaxPerRoute, final int maxTotal,
- final long timeToLive, final TimeUnit tunit) {
+ final long timeToLive, final TimeUnit timeUnit) {
super(new InternalConnFactory(connOperator), defaultMaxPerRoute, maxTotal);
this.log = log;
this.timeToLive = timeToLive;
- this.tunit = tunit;
+ this.timeUnit = timeUnit;
}
@Override
protected HttpPoolEntry createEntry(final HttpRoute route, final OperatedClientConnection conn) {
final String id = Long.toString(COUNTER.getAndIncrement());
- return new HttpPoolEntry(this.log, id, route, conn, this.timeToLive, this.tunit);
+ return new HttpPoolEntry(this.log, id, route, conn, this.timeToLive, this.timeUnit);
}
static class InternalConnFactory implements ConnFactory<HttpRoute, OperatedClientConnection> {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpPoolEntry.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpPoolEntry.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpPoolEntry.java
index b39d952..9a27688 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpPoolEntry.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/HttpPoolEntry.java
@@ -52,8 +52,8 @@ class HttpPoolEntry extends PoolEntry<HttpRoute, OperatedClientConnection> {
final String id,
final HttpRoute route,
final OperatedClientConnection conn,
- final long timeToLive, final TimeUnit tunit) {
- super(id, route, conn, timeToLive, tunit);
+ final long timeToLive, final TimeUnit timeUnit) {
+ super(id, route, conn, timeToLive, timeUnit);
this.log = log;
this.tracker = new RouteTracker(route);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java
index a0b37ae..6013a29 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java
@@ -83,29 +83,29 @@ public class LoggingSessionInputBuffer implements SessionInputBuffer, EofSensor
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
- final int l = this.in.read(b, off, len);
- if (this.wire.enabled() && l > 0) {
- this.wire.input(b, off, l);
+ final int readLen = this.in.read(b, off, len);
+ if (this.wire.enabled() && readLen > 0) {
+ this.wire.input(b, off, readLen);
}
- return l;
+ return readLen;
}
@Override
public int read() throws IOException {
- final int l = this.in.read();
- if (this.wire.enabled() && l != -1) {
- this.wire.input(l);
+ final int b = this.in.read();
+ if (this.wire.enabled() && b != -1) {
+ this.wire.input(b);
}
- return l;
+ return b;
}
@Override
public int read(final byte[] b) throws IOException {
- final int l = this.in.read(b);
- if (this.wire.enabled() && l > 0) {
- this.wire.input(b, 0, l);
+ final int readLen = this.in.read(b);
+ if (this.wire.enabled() && readLen > 0) {
+ this.wire.input(b, 0, readLen);
}
- return l;
+ return readLen;
}
@Override
@@ -120,14 +120,14 @@ public class LoggingSessionInputBuffer implements SessionInputBuffer, EofSensor
@Override
public int readLine(final CharArrayBuffer buffer) throws IOException {
- final int l = this.in.readLine(buffer);
- if (this.wire.enabled() && l >= 0) {
- final int pos = buffer.length() - l;
- final String s = new String(buffer.buffer(), pos, l);
+ final int readLen = this.in.readLine(buffer);
+ if (this.wire.enabled() && readLen >= 0) {
+ final int pos = buffer.length() - readLen;
+ final String s = new String(buffer.buffer(), pos, readLen);
final String tmp = s + "\r\n";
this.wire.input(tmp.getBytes(this.charset));
}
- return l;
+ return readLen;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java
index 3e2fefb..57f3dc6 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java
@@ -98,12 +98,12 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
public PoolingClientConnectionManager(
final SchemeRegistry schemeRegistry,
- final long timeToLive, final TimeUnit tunit) {
- this(schemeRegistry, timeToLive, tunit, new SystemDefaultDnsResolver());
+ final long timeToLive, final TimeUnit timeUnit) {
+ this(schemeRegistry, timeToLive, timeUnit, new SystemDefaultDnsResolver());
}
public PoolingClientConnectionManager(final SchemeRegistry schemeRegistry,
- final long timeToLive, final TimeUnit tunit,
+ final long timeToLive, final TimeUnit timeUnit,
final DnsResolver dnsResolver) {
super();
Args.notNull(schemeRegistry, "Scheme registry");
@@ -111,7 +111,7 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
this.schemeRegistry = schemeRegistry;
this.dnsResolver = dnsResolver;
this.operator = createConnectionOperator(schemeRegistry);
- this.pool = new HttpConnPool(this.log, this.operator, 2, 20, timeToLive, tunit);
+ this.pool = new HttpConnPool(this.log, this.operator, 2, 20, timeToLive, timeUnit);
}
@Override
@@ -196,8 +196,8 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
@Override
public ManagedClientConnection getConnection(
final long timeout,
- final TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException {
- return leaseConnection(future, timeout, tunit);
+ final TimeUnit timeUnit) throws InterruptedException, ConnectionPoolTimeoutException {
+ return leaseConnection(future, timeout, timeUnit);
}
};
@@ -207,10 +207,10 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
ManagedClientConnection leaseConnection(
final Future<HttpPoolEntry> future,
final long timeout,
- final TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException {
+ final TimeUnit timeUnit) throws InterruptedException, ConnectionPoolTimeoutException {
final HttpPoolEntry entry;
try {
- entry = future.get(timeout, tunit);
+ entry = future.get(timeout, timeUnit);
if (entry == null || future.isCancelled()) {
throw new InterruptedException();
}
@@ -234,7 +234,7 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
@Override
public void releaseConnection(
- final ManagedClientConnection conn, final long keepalive, final TimeUnit tunit) {
+ final ManagedClientConnection conn, final long keepalive, final TimeUnit timeUnit) {
Args.check(conn instanceof ManagedClientConnectionImpl, "Connection class mismatch, " +
"connection not obtained from this manager");
@@ -257,11 +257,11 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
}
// Only reusable connections can be kept alive
if (managedConn.isMarkedReusable()) {
- entry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS);
+ entry.updateExpiry(keepalive, timeUnit != null ? timeUnit : TimeUnit.MILLISECONDS);
if (this.log.isDebugEnabled()) {
final String s;
if (keepalive > 0) {
- s = "for " + keepalive + " " + tunit;
+ s = "for " + keepalive + " " + timeUnit;
} else {
s = "indefinitely";
}
@@ -289,11 +289,11 @@ public class PoolingClientConnectionManager implements ClientConnectionManager,
}
@Override
- public void closeIdleConnections(final long idleTimeout, final TimeUnit tunit) {
+ public void closeIdleConnections(final long idleTimeout, final TimeUnit timeUnit) {
if (this.log.isDebugEnabled()) {
- this.log.debug("Closing connections idle longer than " + idleTimeout + " " + tunit);
+ this.log.debug("Closing connections idle longer than " + idleTimeout + " " + timeUnit);
}
- this.pool.closeIdle(idleTimeout, tunit);
+ this.pool.closeIdle(idleTimeout, timeUnit);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java
index 2861b9b..993fa70 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java
@@ -186,7 +186,7 @@ public class SingleClientConnManager implements ClientConnectionManager {
@Override
public ManagedClientConnection getConnection(
- final long timeout, final TimeUnit tunit) {
+ final long timeout, final TimeUnit timeUnit) {
return SingleClientConnManager.this.getConnection(
route, state);
}
@@ -317,16 +317,16 @@ public class SingleClientConnManager implements ClientConnectionManager {
}
@Override
- public void closeIdleConnections(final long idletime, final TimeUnit tunit) {
+ public void closeIdleConnections(final long idletime, final TimeUnit timeUnit) {
assertStillUp();
// idletime can be 0 or negative, no problem there
- Args.notNull(tunit, "Time unit");
+ Args.notNull(timeUnit, "Time unit");
synchronized (this) {
if ((managedConn == null) && uniquePoolEntry.connection.isOpen()) {
final long cutoff =
- System.currentTimeMillis() - tunit.toMillis(idletime);
+ System.currentTimeMillis() - timeUnit.toMillis(idletime);
if (lastReleaseTime <= cutoff) {
try {
uniquePoolEntry.close();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/AbstractConnPool.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
index d9dfbfe..f9fd517 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
@@ -99,7 +99,7 @@ public abstract class AbstractConnPool {
* @param route the route for which to get the connection
* @param state the state
* @param timeout the timeout, 0 or negative for no timeout
- * @param tunit the unit for the {@code timeout},
+ * @param timeUnit the unit for the {@code timeout},
* may be {@code null} only if there is no timeout
*
* @return pool entry holding a connection for the route
@@ -114,9 +114,9 @@ public abstract class AbstractConnPool {
final HttpRoute route,
final Object state,
final long timeout,
- final TimeUnit tunit)
+ final TimeUnit timeUnit)
throws ConnectionPoolTimeoutException, InterruptedException {
- return requestPoolEntry(route, state).getPoolEntry(timeout, tunit);
+ return requestPoolEntry(route, state).getPoolEntry(timeout, timeUnit);
}
/**
@@ -154,16 +154,16 @@ public abstract class AbstractConnPool {
*
* @param idletime the time the connections should have been idle
* in order to be closed now
- * @param tunit the unit for the {@code idletime}
+ * @param timeUnit the unit for the {@code idletime}
*/
- public void closeIdleConnections(final long idletime, final TimeUnit tunit) {
+ public void closeIdleConnections(final long idletime, final TimeUnit timeUnit) {
// idletime can be 0 or negative, no problem there
- Args.notNull(tunit, "Time unit");
+ Args.notNull(timeUnit, "Time unit");
poolLock.lock();
try {
- idleConnHandler.closeIdleConnections(tunit.toMillis(idletime));
+ idleConnHandler.closeIdleConnections(timeUnit.toMillis(idletime));
} finally {
poolLock.unlock();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
index 31914c4..07f4afd 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
@@ -295,9 +295,9 @@ public class ConnPoolByRoute extends AbstractConnPool {
@Override
public BasicPoolEntry getPoolEntry(
final long timeout,
- final TimeUnit tunit)
+ final TimeUnit timeUnit)
throws InterruptedException, ConnectionPoolTimeoutException {
- return getEntryBlocking(route, state, timeout, tunit, aborter);
+ return getEntryBlocking(route, state, timeout, timeUnit, aborter);
}
};
@@ -310,7 +310,7 @@ public class ConnPoolByRoute extends AbstractConnPool {
*
* @param route the route for which to get the connection
* @param timeout the timeout, 0 or negative for no timeout
- * @param tunit the unit for the {@code timeout},
+ * @param timeUnit the unit for the {@code timeout},
* may be {@code null} only if there is no timeout
* @param aborter an object which can abort a {@link WaitingThread}.
*
@@ -323,14 +323,14 @@ public class ConnPoolByRoute extends AbstractConnPool {
*/
protected BasicPoolEntry getEntryBlocking(
final HttpRoute route, final Object state,
- final long timeout, final TimeUnit tunit,
+ final long timeout, final TimeUnit timeUnit,
final WaitingThreadAborter aborter)
throws ConnectionPoolTimeoutException, InterruptedException {
Date deadline = null;
if (timeout > 0) {
deadline = new Date
- (System.currentTimeMillis() + tunit.toMillis(timeout));
+ (System.currentTimeMillis() + timeUnit.toMillis(timeout));
}
BasicPoolEntry entry = null;
@@ -710,17 +710,17 @@ public class ConnPoolByRoute extends AbstractConnPool {
*
* @param idletime the time the connections should have been idle
* in order to be closed now
- * @param tunit the unit for the {@code idletime}
+ * @param timeUnit the unit for the {@code idletime}
*/
@Override
- public void closeIdleConnections(final long idletime, final TimeUnit tunit) {
- Args.notNull(tunit, "Time unit");
+ public void closeIdleConnections(final long idletime, final TimeUnit timeUnit) {
+ Args.notNull(timeUnit, "Time unit");
final long t = idletime > 0 ? idletime : 0;
if (log.isDebugEnabled()) {
- log.debug("Closing connections idle longer than " + t + " " + tunit);
+ log.debug("Closing connections idle longer than " + t + " " + timeUnit);
}
// the latest time for which connections will be closed
- final long deadline = System.currentTimeMillis() - tunit.toMillis(t);
+ final long deadline = System.currentTimeMillis() - timeUnit.toMillis(t);
poolLock.lock();
try {
final Iterator<BasicPoolEntry> iter = freeConnections.iterator();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java
index 52b3564..5090888 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java
@@ -46,7 +46,7 @@ public interface PoolEntryRequest {
* an {@link InterruptedException} is thrown.
*
* @param timeout the timeout, 0 or negative for no timeout
- * @param tunit the unit for the {@code timeout},
+ * @param timeUnit the unit for the {@code timeout},
* may be {@code null} only if there is no timeout
*
* @return pool entry holding a connection for the route
@@ -58,7 +58,7 @@ public interface PoolEntryRequest {
*/
BasicPoolEntry getPoolEntry(
long timeout,
- TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException;
+ TimeUnit timeUnit) throws InterruptedException, ConnectionPoolTimeoutException;
/**
* Aborts the active or next call to
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
index 74f1118..dd2147a 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
@@ -232,7 +232,7 @@ public class ThreadSafeClientConnManager implements ClientConnectionManager {
@Override
public ManagedClientConnection getConnection(
- final long timeout, final TimeUnit tunit) throws InterruptedException,
+ final long timeout, final TimeUnit timeUnit) throws InterruptedException,
ConnectionPoolTimeoutException {
Args.notNull(route, "Route");
@@ -240,7 +240,7 @@ public class ThreadSafeClientConnManager implements ClientConnectionManager {
log.debug("Get connection: " + route + ", timeout = " + timeout);
}
- final BasicPoolEntry entry = poolRequest.getPoolEntry(timeout, tunit);
+ final BasicPoolEntry entry = poolRequest.getPoolEntry(timeout, timeUnit);
return new BasicPooledConnAdapter(ThreadSafeClientConnManager.this, entry);
}
@@ -327,11 +327,11 @@ public class ThreadSafeClientConnManager implements ClientConnectionManager {
}
@Override
- public void closeIdleConnections(final long idleTimeout, final TimeUnit tunit) {
+ public void closeIdleConnections(final long idleTimeout, final TimeUnit timeUnit) {
if (log.isDebugEnabled()) {
- log.debug("Closing connections idle longer than " + idleTimeout + " " + tunit);
+ log.debug("Closing connections idle longer than " + idleTimeout + " " + timeUnit);
}
- pool.closeIdleConnections(idleTimeout, tunit);
+ pool.closeIdleConnections(idleTimeout, timeUnit);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
index 30a578e..8e7f0e9 100644
--- a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
+++ b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
@@ -112,9 +112,8 @@ public final class AuthSchemeRegistry implements Lookup<AuthSchemeProvider> {
final AuthSchemeFactory factory = registeredSchemes.get(name.toLowerCase(Locale.ENGLISH));
if (factory != null) {
return factory.newInstance(params);
- } else {
- throw new IllegalStateException("Unsupported authentication scheme: " + name);
}
+ throw new IllegalStateException("Unsupported authentication scheme: " + name);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/entity/DecompressingEntity.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/entity/DecompressingEntity.java b/httpclient/src/main/java/org/apache/http/client/entity/DecompressingEntity.java
index 08d7c6d..27ee00d 100644
--- a/httpclient/src/main/java/org/apache/http/client/entity/DecompressingEntity.java
+++ b/httpclient/src/main/java/org/apache/http/client/entity/DecompressingEntity.java
@@ -79,23 +79,22 @@ public class DecompressingEntity extends HttpEntityWrapper {
content = getDecompressingStream();
}
return content;
- } else {
- return getDecompressingStream();
}
+ return getDecompressingStream();
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = getContent();
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = getContent();
try {
final byte[] buffer = new byte[BUFFER_SIZE];
int l;
- while ((l = instream.read(buffer)) != -1) {
- outstream.write(buffer, 0, l);
+ while ((l = inStream.read(buffer)) != -1) {
+ outStream.write(buffer, 0, l);
}
} finally {
- instream.close();
+ inStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java b/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java
index 3008239..cfa45df 100644
--- a/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java
+++ b/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java
@@ -101,9 +101,9 @@ public class GzipCompressingEntity extends HttpEntityWrapper {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final GZIPOutputStream gzip = new GZIPOutputStream(outstream);
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final GZIPOutputStream gzip = new GZIPOutputStream(outStream);
wrappedEntity.writeTo(gzip);
// Only close output stream if the wrapped entity has been
// successfully written out
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/entity/InputStreamFactory.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/entity/InputStreamFactory.java b/httpclient/src/main/java/org/apache/http/client/entity/InputStreamFactory.java
index 4753cf6..56d99d6 100644
--- a/httpclient/src/main/java/org/apache/http/client/entity/InputStreamFactory.java
+++ b/httpclient/src/main/java/org/apache/http/client/entity/InputStreamFactory.java
@@ -36,6 +36,6 @@ import java.io.InputStream;
*/
public interface InputStreamFactory {
- InputStream create(InputStream instream) throws IOException;
+ InputStream create(InputStream inStream) throws IOException;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java b/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java
index dbfbd0e..c52ece5 100644
--- a/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java
+++ b/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java
@@ -189,11 +189,10 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpUriRe
*/
public static HttpRequestWrapper wrap(final HttpRequest request, final HttpHost target) {
Args.notNull(request, "HTTP request");
- if (request instanceof HttpEntityEnclosingRequest) {
- return new HttpEntityEnclosingRequestWrapper((HttpEntityEnclosingRequest) request, target);
- } else {
- return new HttpRequestWrapper(request, target);
- }
+ return request instanceof HttpEntityEnclosingRequest
+ ? new HttpEntityEnclosingRequestWrapper(
+ (HttpEntityEnclosingRequest) request, target)
+ : new HttpRequestWrapper(request, target);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java b/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
index e763e9a..e815d8a 100644
--- a/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
+++ b/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
@@ -134,11 +134,9 @@ public class HttpClientContext extends HttpCoreContext {
public static final String REQUEST_CONFIG = "http.request-config";
public static HttpClientContext adapt(final HttpContext context) {
- if (context instanceof HttpClientContext) {
- return (HttpClientContext) context;
- } else {
- return new HttpClientContext(context);
- }
+ return context instanceof HttpClientContext
+ ? (HttpClientContext) context
+ : new HttpClientContext(context);
}
public static HttpClientContext create() {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java
index be8e56d..ed2db74 100644
--- a/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java
+++ b/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java
@@ -59,15 +59,13 @@ public class CloneUtils {
final Throwable cause = ex.getCause();
if (cause instanceof CloneNotSupportedException) {
throw ((CloneNotSupportedException) cause);
- } else {
- throw new Error("Unexpected exception", cause);
}
+ throw new Error("Unexpected exception", cause);
} catch (final IllegalAccessException ex) {
throw new IllegalAccessError(ex.getMessage());
}
- } else {
- throw new CloneNotSupportedException();
}
+ throw new CloneNotSupportedException();
}
public static Object clone(final Object obj) throws CloneNotSupportedException {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java b/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java
index 0a79b4a..35c74de 100644
--- a/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java
+++ b/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java
@@ -495,11 +495,9 @@ public class URIBuilder {
}
public List<NameValuePair> getQueryParams() {
- if (this.queryParams != null) {
- return new ArrayList<NameValuePair>(this.queryParams);
- } else {
- return new ArrayList<NameValuePair>();
- }
+ return this.queryParams != null
+ ? new ArrayList<NameValuePair>(this.queryParams)
+ : new ArrayList<NameValuePair>();
}
public String getFragment() {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
index 02f8c1a..7bb01c6 100644
--- a/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
+++ b/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
@@ -211,20 +211,12 @@ public class URIUtils {
}
if (route.getProxyHost() != null && !route.isTunnelled()) {
// Make sure the request URI is absolute
- if (!uri.isAbsolute()) {
- final HttpHost target = route.getTargetHost();
- return rewriteURI(uri, target, true);
- } else {
- return rewriteURI(uri);
- }
- } else {
- // Make sure the request URI is relative
- if (uri.isAbsolute()) {
- return rewriteURI(uri, null, true);
- } else {
- return rewriteURI(uri);
- }
+ return uri.isAbsolute()
+ ? rewriteURI(uri)
+ : rewriteURI(uri, route.getTargetHost(), true);
}
+ // Make sure the request URI is relative
+ return uri.isAbsolute() ? rewriteURI(uri, null, true) : rewriteURI(uri);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
index d85cf8d..0397cc4 100644
--- a/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
+++ b/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
@@ -124,14 +124,14 @@ public class URLEncodedUtils {
final long len = entity.getContentLength();
Args.check(len <= Integer.MAX_VALUE, "HTTP entity is too large");
final Charset charset = contentType.getCharset() != null ? contentType.getCharset() : HTTP.DEF_CONTENT_CHARSET;
- final InputStream instream = entity.getContent();
- if (instream == null) {
+ final InputStream inStream = entity.getContent();
+ if (inStream == null) {
return createEmptyList();
}
final CharArrayBuffer buf;
try {
buf = new CharArrayBuffer(len > 0 ? (int) len : 1024);
- final Reader reader = new InputStreamReader(instream, charset);
+ final Reader reader = new InputStreamReader(inStream, charset);
final char[] tmp = new char[1024];
int l;
while((l = reader.read(tmp)) != -1) {
@@ -139,7 +139,7 @@ public class URLEncodedUtils {
}
} finally {
- instream.close();
+ inStream.close();
}
if (buf.isEmpty()) {
return createEmptyList();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/ClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/ClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/conn/ClientConnectionManager.java
index 8b30e68..845507c 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ClientConnectionManager.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ClientConnectionManager.java
@@ -92,11 +92,11 @@ public interface ClientConnectionManager {
* All expired connections will also be closed.
*
* @param idletime the idle time of connections to be closed
- * @param tunit the unit for the {@code idletime}
+ * @param timeUnit the unit for the {@code idletime}
*
* @see #closeExpiredConnections()
*/
- void closeIdleConnections(long idletime, TimeUnit tunit);
+ void closeIdleConnections(long idletime, TimeUnit timeUnit);
/**
* Closes all expired connections in the pool.
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/ClientConnectionRequest.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/ClientConnectionRequest.java b/httpclient/src/main/java/org/apache/http/conn/ClientConnectionRequest.java
index cd8d5c4..afb053e 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ClientConnectionRequest.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ClientConnectionRequest.java
@@ -51,7 +51,7 @@ public interface ClientConnectionRequest {
* be thrown.
*
* @param timeout the timeout, 0 or negative for no timeout
- * @param tunit the unit for the {@code timeout},
+ * @param timeUnit the unit for the {@code timeout},
* may be {@code null} only if there is no timeout
*
* @return a connection that can be used to communicate
@@ -62,7 +62,7 @@ public interface ClientConnectionRequest {
* @throws InterruptedException
* if the calling thread is interrupted while waiting
*/
- ManagedClientConnection getConnection(long timeout, TimeUnit tunit)
+ ManagedClientConnection getConnection(long timeout, TimeUnit timeUnit)
throws InterruptedException, ConnectionPoolTimeoutException;
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/ConnectionRequest.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/ConnectionRequest.java b/httpclient/src/main/java/org/apache/http/conn/ConnectionRequest.java
index 3520a52..ccd9eb3 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ConnectionRequest.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ConnectionRequest.java
@@ -52,7 +52,7 @@ public interface ConnectionRequest extends Cancellable {
* be thrown.
*
* @param timeout the timeout, 0 or negative for no timeout
- * @param tunit the unit for the {@code timeout},
+ * @param timeUnit the unit for the {@code timeout},
* may be {@code null} only if there is no timeout
*
* @return a connection that can be used to communicate
@@ -63,7 +63,7 @@ public interface ConnectionRequest extends Cancellable {
* @throws InterruptedException
* if the calling thread is interrupted while waiting
*/
- HttpClientConnection get(long timeout, TimeUnit tunit)
+ HttpClientConnection get(long timeout, TimeUnit timeUnit)
throws InterruptedException, ExecutionException, ConnectionPoolTimeoutException;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/EofSensorInputStream.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/EofSensorInputStream.java b/httpclient/src/main/java/org/apache/http/conn/EofSensorInputStream.java
index fb7de2d..774c65b 100644
--- a/httpclient/src/main/java/org/apache/http/conn/EofSensorInputStream.java
+++ b/httpclient/src/main/java/org/apache/http/conn/EofSensorInputStream.java
@@ -111,36 +111,36 @@ public class EofSensorInputStream extends InputStream implements ConnectionRelea
@Override
public int read() throws IOException {
- int l = -1;
+ int readLen = -1;
if (isReadAllowed()) {
try {
- l = wrappedStream.read();
- checkEOF(l);
+ readLen = wrappedStream.read();
+ checkEOF(readLen);
} catch (final IOException ex) {
checkAbort();
throw ex;
}
}
- return l;
+ return readLen;
}
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
- int l = -1;
+ int readLen = -1;
if (isReadAllowed()) {
try {
- l = wrappedStream.read(b, off, len);
- checkEOF(l);
+ readLen = wrappedStream.read(b, off, len);
+ checkEOF(readLen);
} catch (final IOException ex) {
checkAbort();
throw ex;
}
}
- return l;
+ return readLen;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java
index 70c2908..d39f179 100644
--- a/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java
+++ b/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java
@@ -155,11 +155,11 @@ public interface HttpClientConnectionManager {
* </p>
*
* @param idletime the idle time of connections to be closed
- * @param tunit the unit for the {@code idletime}
+ * @param timeUnit the unit for the {@code idletime}
*
* @see #closeExpiredConnections()
*/
- void closeIdleConnections(long idletime, TimeUnit tunit);
+ void closeIdleConnections(long idletime, TimeUnit timeUnit);
/**
* Closes all expired connections in the pool.
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java b/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
index 8a06797..2d5384e 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
@@ -32,7 +32,6 @@ import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLSession;
-import org.apache.http.HttpClientConnection;
import org.apache.http.HttpHost;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.params.HttpParams;
@@ -48,7 +47,7 @@ import org.apache.http.protocol.HttpContext;
*/
@Deprecated
public interface ManagedClientConnection extends
- HttpClientConnection, HttpRoutedConnection, ManagedHttpClientConnection, ConnectionReleaseTrigger {
+ HttpRoutedConnection, ManagedHttpClientConnection, ConnectionReleaseTrigger {
/**
* Indicates whether this connection is secure.
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java b/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
index 60a02e7..bf843da 100644
--- a/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
+++ b/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
@@ -103,16 +103,13 @@ public final class HttpRoute implements RouteInfo, Cloneable {
private static HttpHost normalize(final HttpHost target) {
if (target.getPort() >= 0 ) {
return target;
- } else {
- final InetAddress address = target.getAddress();
- final String schemeName = target.getSchemeName();
- if (address != null) {
- return new HttpHost(address, getDefaultPort(schemeName), schemeName);
- } else {
- final String hostName = target.getHostName();
- return new HttpHost(hostName, getDefaultPort(schemeName), schemeName);
- }
}
+ final InetAddress address = target.getAddress();
+ final String schemeName = target.getSchemeName();
+ return address != null
+ ? new HttpHost(address, getDefaultPort(schemeName), schemeName)
+ : new HttpHost(target.getHostName(), getDefaultPort(schemeName),
+ schemeName);
}
/**
@@ -238,11 +235,7 @@ public final class HttpRoute implements RouteInfo, Cloneable {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
- if (hop < hopcount - 1) {
- return this.proxyChain.get(hop);
- } else {
- return this.targetHost;
- }
+ return hop < hopcount - 1 ? this.proxyChain.get(hop) : this.targetHost;
}
@Override
@@ -298,9 +291,8 @@ public final class HttpRoute implements RouteInfo, Cloneable {
LangUtils.equals(this.targetHost, that.targetHost) &&
LangUtils.equals(this.localAddress, that.localAddress) &&
LangUtils.equals(this.proxyChain, that.proxyChain);
- } else {
- return false;
}
+ return false;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java b/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
index 6d02b95..3201710 100644
--- a/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
+++ b/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
@@ -163,14 +163,11 @@ public final class Scheme {
public final SocketFactory getSocketFactory() {
if (this.socketFactory instanceof SchemeSocketFactoryAdaptor) {
return ((SchemeSocketFactoryAdaptor) this.socketFactory).getFactory();
- } else {
- if (this.layered) {
- return new LayeredSocketFactoryAdaptor(
- (LayeredSchemeSocketFactory) this.socketFactory);
- } else {
- return new SocketFactoryAdaptor(this.socketFactory);
- }
}
+ return this.layered
+ ? new LayeredSocketFactoryAdaptor(
+ (LayeredSchemeSocketFactory) this.socketFactory)
+ : new SocketFactoryAdaptor(this.socketFactory);
}
/**
@@ -245,9 +242,8 @@ public final class Scheme {
return this.name.equals(that.name)
&& this.defaultPort == that.defaultPort
&& this.layered == that.layered;
- } else {
- return false;
}
+ return false;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactoryAdaptor.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactoryAdaptor.java b/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactoryAdaptor.java
index 08de43e..049145d 100644
--- a/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactoryAdaptor.java
+++ b/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactoryAdaptor.java
@@ -88,11 +88,9 @@ class SchemeSocketFactoryAdaptor implements SchemeSocketFactory {
if (this == obj) {
return true;
}
- if (obj instanceof SchemeSocketFactoryAdaptor) {
- return this.factory.equals(((SchemeSocketFactoryAdaptor)obj).factory);
- } else {
- return this.factory.equals(obj);
- }
+ return obj instanceof SchemeSocketFactoryAdaptor
+ ? this.factory.equals(((SchemeSocketFactoryAdaptor) obj).factory)
+ : this.factory.equals(obj);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/scheme/SocketFactoryAdaptor.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/scheme/SocketFactoryAdaptor.java b/httpclient/src/main/java/org/apache/http/conn/scheme/SocketFactoryAdaptor.java
index 3a9f9a0..65a160b 100644
--- a/httpclient/src/main/java/org/apache/http/conn/scheme/SocketFactoryAdaptor.java
+++ b/httpclient/src/main/java/org/apache/http/conn/scheme/SocketFactoryAdaptor.java
@@ -85,11 +85,9 @@ class SocketFactoryAdaptor implements SocketFactory {
if (this == obj) {
return true;
}
- if (obj instanceof SocketFactoryAdaptor) {
- return this.factory.equals(((SocketFactoryAdaptor)obj).factory);
- } else {
- return this.factory.equals(obj);
- }
+ return obj instanceof SocketFactoryAdaptor
+ ? this.factory.equals(((SocketFactoryAdaptor) obj).factory)
+ : this.factory.equals(obj);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
index ec7c0bf..4877b30 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
@@ -214,9 +214,8 @@ public abstract class AbstractVerifier implements X509HostnameVerifier {
match = normalizedHost.endsWith(normalizedIdentity.substring(1));
}
return match && (!strict || countDots(normalizedHost) == countDots(normalizedIdentity));
- } else {
- return normalizedHost.equals(normalizedIdentity);
}
+ return normalizedHost.equals(normalizedIdentity);
}
private static boolean validCountryWildcard(final String parts[]) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/e6c226d5/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
index e7f9b28..6ec4412 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
@@ -351,9 +351,8 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
sslsock.startHandshake();
verifyHostname(sslsock, host.getHostName());
return sock;
- } else {
- return createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), context);
}
+ return createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), context);
}
@Override