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/08/13 22:58:14 UTC
httpcomponents-client git commit: Use camel-case for ivars and param
names; don't nest with else clauses unnecessarily;
comment intention of empty blocks;
use "readLen" name for local var instead of "i" or other cryptic name to hold
read length of a read
Repository: httpcomponents-client
Updated Branches:
refs/heads/master 4a9b00b50 -> 1c7075079
Use camel-case for ivars and param names; don't nest with else clauses
unnecessarily; comment intention of empty blocks; use "readLen" name for
local var instead of "i" or other cryptic name to hold read length of a
read() API call; no need to specify default values in ivar declarations.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/1c707507
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/1c707507
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/1c707507
Branch: refs/heads/master
Commit: 1c707507918358d64678afeda3e80a024d05bf30
Parents: 4a9b00b
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Aug 13 16:58:10 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Mon Aug 13 16:58:10 2018 -0600
----------------------------------------------------------------------
.../hc/client5/http/impl/cache/CachingExec.java | 4 +--
.../client5/http/impl/cache/CombinedEntity.java | 10 +++---
.../http/impl/cache/FileResourceFactory.java | 4 +--
.../apache/hc/client5/http/fluent/Request.java | 8 ++---
.../http/examples/ClientConnectionRelease.java | 4 +--
.../http/entity/DecompressingEntity.java | 10 +++---
.../http/entity/GzipCompressingEntity.java | 6 ++--
.../http/entity/mime/MultipartFormEntity.java | 12 +++----
.../http/impl/classic/RequestEntityProxy.java | 4 +--
.../http/impl/classic/ResponseEntityProxy.java | 6 ++--
.../hc/client5/http/auth/TestCredentials.java | 24 +++++++-------
.../http/entity/TestDecompressingEntity.java | 4 +--
.../TestAbstractHttpClientResponseHandler.java | 6 ++--
.../impl/classic/TestBasicResponseHandler.java | 6 ++--
.../http/impl/classic/TestConnectExec.java | 12 +++----
.../http/impl/classic/TestProtocolExec.java | 30 ++++++++---------
.../http/impl/classic/TestRedirectExec.java | 18 +++++------
.../impl/classic/TestResponseEntityWrapper.java | 30 ++++++++---------
.../http/impl/cookie/TestBasicClientCookie.java | 12 +++----
.../http/impl/cookie/TestBasicCookieStore.java | 34 ++++++++++----------
20 files changed, 122 insertions(+), 122 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
index ebf5b72..a515094 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
@@ -396,11 +396,11 @@ public class CachingExec extends CachingExecBase implements ExecChainHandler {
final HttpEntity entity = backendResponse.getEntity();
if (entity != null) {
buf = new ByteArrayBuffer(1024);
- final InputStream instream = entity.getContent();
+ final InputStream inStream = entity.getContent();
final byte[] tmp = new byte[2048];
long total = 0;
int l;
- while ((l = instream.read(tmp)) != -1) {
+ while ((l = inStream.read(tmp)) != -1) {
buf.append(tmp, 0, l);
total += l;
if (total > cacheConfig.getMaxObjectSize()) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CombinedEntity.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CombinedEntity.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CombinedEntity.java
index 40ab706..4d89a2e 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CombinedEntity.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CombinedEntity.java
@@ -99,13 +99,13 @@ class CombinedEntity implements HttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- try (InputStream instream = getContent()) {
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ try (InputStream inStream = getContent()) {
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);
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResourceFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResourceFactory.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResourceFactory.java
index d1c8232..99f1ddb 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResourceFactory.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResourceFactory.java
@@ -79,9 +79,9 @@ public class FileResourceFactory implements ResourceFactory {
final byte[] content, final int off, final int len) throws ResourceIOException {
Args.notNull(requestId, "Request id");
final File file = generateUniqueCacheFile(requestId);
- try (FileOutputStream outstream = new FileOutputStream(file)) {
+ try (FileOutputStream outStream = new FileOutputStream(file)) {
if (content != null) {
- outstream.write(content, off, len);
+ outStream.write(content, off, len);
}
} catch (final IOException ex) {
throw new ResourceIOException(ex.getMessage(), ex);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
----------------------------------------------------------------------
diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
index da9695d..fca40f4 100644
--- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
+++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
@@ -359,12 +359,12 @@ public class Request {
return body(new ByteArrayEntity(b, off, len, contentType));
}
- public Request bodyStream(final InputStream instream) {
- return body(new InputStreamEntity(instream, -1, null));
+ public Request bodyStream(final InputStream inStream) {
+ return body(new InputStreamEntity(inStream, -1, null));
}
- public Request bodyStream(final InputStream instream, final ContentType contentType) {
- return body(new InputStreamEntity(instream, -1, contentType));
+ public Request bodyStream(final InputStream inStream, final ContentType contentType) {
+ return body(new InputStreamEntity(inStream, -1, contentType));
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConnectionRelease.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConnectionRelease.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConnectionRelease.java
index 4f6fe1e..cab1778 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConnectionRelease.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConnectionRelease.java
@@ -57,8 +57,8 @@ public class ClientConnectionRelease {
// If the response does not enclose an entity, there is no need
// to bother about connection release
if (entity != null) {
- try (InputStream instream = entity.getContent()) {
- instream.read();
+ try (InputStream inStream = entity.getContent()) {
+ inStream.read();
// do something useful with the response
} catch (final IOException ex) {
// In case of an IOException the connection will be released
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/main/java/org/apache/hc/client5/http/entity/DecompressingEntity.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/DecompressingEntity.java b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/DecompressingEntity.java
index 9cb8427..5b10188 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/DecompressingEntity.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/DecompressingEntity.java
@@ -83,13 +83,13 @@ public class DecompressingEntity extends HttpEntityWrapper {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- try (InputStream instream = getContent()) {
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ try (InputStream inStream = getContent()) {
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);
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/main/java/org/apache/hc/client5/http/entity/GzipCompressingEntity.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/GzipCompressingEntity.java b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/GzipCompressingEntity.java
index 742cf29..04a3507 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/GzipCompressingEntity.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/GzipCompressingEntity.java
@@ -71,9 +71,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);
super.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/1c707507/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartFormEntity.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartFormEntity.java b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartFormEntity.java
index d0a59e9..9615fc5 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartFormEntity.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartFormEntity.java
@@ -98,15 +98,15 @@ class MultipartFormEntity implements HttpEntity {
} else if (this.contentLength > 25 * 1024) {
throw new ContentTooLongException("Content length is too long: " + this.contentLength);
}
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- writeTo(outstream);
- outstream.flush();
- return new ByteArrayInputStream(outstream.toByteArray());
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ writeTo(outStream);
+ outStream.flush();
+ return new ByteArrayInputStream(outStream.toByteArray());
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- this.multipart.writeTo(outstream);
+ public void writeTo(final OutputStream outStream) throws IOException {
+ this.multipart.writeTo(outStream);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RequestEntityProxy.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RequestEntityProxy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RequestEntityProxy.java
index d2c4537..4a9b81a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RequestEntityProxy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RequestEntityProxy.java
@@ -106,9 +106,9 @@ class RequestEntityProxy implements HttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
+ public void writeTo(final OutputStream outStream) throws IOException {
consumed = true;
- original.writeTo(outstream);
+ original.writeTo(outStream);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java
index 6dcdcad..9dc5504 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ResponseEntityProxy.java
@@ -92,10 +92,10 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
+ public void writeTo(final OutputStream outStream) throws IOException {
try {
- if (outstream != null) {
- super.writeTo(outstream);
+ if (outStream != null) {
+ super.writeTo(outStream);
}
releaseConnection();
} catch (final IOException | RuntimeException ex) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java
index 30f925d..60177d3 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java
@@ -172,13 +172,13 @@ public class TestCredentials {
public void testUsernamePasswordCredentialsSerialization() throws Exception {
final UsernamePasswordCredentials orig = new UsernamePasswordCredentials("name","pwd".toCharArray());
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
- final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer);
- outstream.writeObject(orig);
- outstream.close();
+ final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer);
+ outStream.writeObject(orig);
+ outStream.close();
final byte[] raw = outbuffer.toByteArray();
- final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
- final ObjectInputStream instream = new ObjectInputStream(inbuffer);
- final UsernamePasswordCredentials clone = (UsernamePasswordCredentials) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final UsernamePasswordCredentials clone = (UsernamePasswordCredentials) inStream.readObject();
Assert.assertEquals(orig, clone);
}
@@ -186,13 +186,13 @@ public class TestCredentials {
public void testNTCredentialsSerialization() throws Exception {
final NTCredentials orig = new NTCredentials("name","pwd".toCharArray(), "somehost", "domain");
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
- final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer);
- outstream.writeObject(orig);
- outstream.close();
+ final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer);
+ outStream.writeObject(orig);
+ outStream.close();
final byte[] raw = outbuffer.toByteArray();
- final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
- final ObjectInputStream instream = new ObjectInputStream(inbuffer);
- final NTCredentials clone = (NTCredentials) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final NTCredentials clone = (NTCredentials) inStream.readObject();
Assert.assertEquals(orig, clone);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
index 8830527..e668975 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
@@ -97,8 +97,8 @@ public class TestDecompressingEntity {
super(wrapped, new InputStreamFactory() {
@Override
- public InputStream create(final InputStream instream) throws IOException {
- return new CheckedInputStream(instream, checksum);
+ public InputStream create(final InputStream inStream) throws IOException {
+ return new CheckedInputStream(inStream, checksum);
}
});
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestAbstractHttpClientResponseHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestAbstractHttpClientResponseHandler.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestAbstractHttpClientResponseHandler.java
index 24b2975..0f0b23d 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestAbstractHttpClientResponseHandler.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestAbstractHttpClientResponseHandler.java
@@ -65,10 +65,10 @@ public class TestAbstractHttpClientResponseHandler {
@SuppressWarnings("boxing")
@Test
public void testUnsuccessfulResponse() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
+ final InputStream inStream = Mockito.mock(InputStream.class);
final HttpEntity entity = Mockito.mock(HttpEntity.class);
Mockito.when(entity.isStreaming()).thenReturn(true);
- Mockito.when(entity.getContent()).thenReturn(instream);
+ Mockito.when(entity.getContent()).thenReturn(inStream);
final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
Mockito.when(response.getCode()).thenReturn(404);
Mockito.when(response.getEntity()).thenReturn(entity);
@@ -81,7 +81,7 @@ public class TestAbstractHttpClientResponseHandler {
Assert.assertEquals(404, ex.getStatusCode());
}
Mockito.verify(entity).getContent();
- Mockito.verify(instream).close();
+ Mockito.verify(inStream).close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestBasicResponseHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestBasicResponseHandler.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestBasicResponseHandler.java
index 08ac384..958b903 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestBasicResponseHandler.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestBasicResponseHandler.java
@@ -57,10 +57,10 @@ public class TestBasicResponseHandler {
@Test
public void testUnsuccessfulResponse() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
+ final InputStream inStream = Mockito.mock(InputStream.class);
final HttpEntity entity = Mockito.mock(HttpEntity.class);
Mockito.when(entity.isStreaming()).thenReturn(true);
- Mockito.when(entity.getContent()).thenReturn(instream);
+ Mockito.when(entity.getContent()).thenReturn(inStream);
final ClassicHttpResponse response = Mockito.mock(ClassicHttpResponse.class);
Mockito.when(response.getCode()).thenReturn(404);
Mockito.when(response.getEntity()).thenReturn(entity);
@@ -73,7 +73,7 @@ public class TestBasicResponseHandler {
Assert.assertEquals(404, ex.getStatusCode());
}
Mockito.verify(entity).getContent();
- Mockito.verify(instream).close();
+ Mockito.verify(inStream).close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestConnectExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestConnectExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestConnectExec.java
index c7755fd..744f0a7 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestConnectExec.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestConnectExec.java
@@ -234,9 +234,9 @@ public class TestConnectExec {
final ClassicHttpRequest request = new HttpGet("http://bar/test");
final ClassicHttpResponse response1 = new BasicClassicHttpResponse(407, "Huh?");
response1.setHeader(HttpHeaders.PROXY_AUTHENTICATE, "Basic realm=test");
- final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
+ final InputStream inStream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
response1.setEntity(EntityBuilder.create()
- .setStream(instream1)
+ .setStream(inStream1)
.build());
final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
@@ -264,7 +264,7 @@ public class TestConnectExec {
exec.execute(request, scope, execChain);
Mockito.verify(execRuntime).connect(context);
- Mockito.verify(instream1).close();
+ Mockito.verify(inStream1).close();
}
@Test
@@ -274,9 +274,9 @@ public class TestConnectExec {
final ClassicHttpRequest request = new HttpGet("http://bar/test");
final ClassicHttpResponse response1 = new BasicClassicHttpResponse(407, "Huh?");
response1.setHeader(HttpHeaders.PROXY_AUTHENTICATE, "Basic realm=test");
- final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
+ final InputStream inStream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
response1.setEntity(EntityBuilder.create()
- .setStream(instream1)
+ .setStream(inStream1)
.build());
final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
@@ -304,7 +304,7 @@ public class TestConnectExec {
exec.execute(request, scope, execChain);
Mockito.verify(execRuntime).connect(context);
- Mockito.verify(instream1, Mockito.never()).close();
+ Mockito.verify(inStream1, Mockito.never()).close();
Mockito.verify(execRuntime).disconnect();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestProtocolExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestProtocolExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestProtocolExec.java
index 049f79f..b385dc1 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestProtocolExec.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestProtocolExec.java
@@ -214,14 +214,14 @@ public class TestProtocolExec {
final ClassicHttpRequest request = new HttpGet("http://foo/test");
final ClassicHttpResponse response1 = new BasicClassicHttpResponse(401, "Huh?");
response1.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=test");
- final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
+ final InputStream inStream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
response1.setEntity(EntityBuilder.create()
- .setStream(instream1)
+ .setStream(inStream1)
.build());
final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
- final InputStream instream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {2, 3, 4}));
+ final InputStream inStream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {2, 3, 4}));
response2.setEntity(EntityBuilder.create()
- .setStream(instream2)
+ .setStream(inStream2)
.build());
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
@@ -240,8 +240,8 @@ public class TestProtocolExec {
final ExecChain.Scope scope = new ExecChain.Scope("test", route, request, execRuntime, context);
final ClassicHttpResponse finalResponse = protocolExec.execute(request, scope, chain);
Mockito.verify(chain, Mockito.times(2)).proceed(request, scope);
- Mockito.verify(instream1).close();
- Mockito.verify(instream2, Mockito.never()).close();
+ Mockito.verify(inStream1).close();
+ Mockito.verify(inStream2, Mockito.never()).close();
Assert.assertNotNull(finalResponse);
Assert.assertEquals(200, finalResponse.getCode());
@@ -253,14 +253,14 @@ public class TestProtocolExec {
final ClassicHttpRequest request = new HttpGet("http://foo/test");
final ClassicHttpResponse response1 = new BasicClassicHttpResponse(401, "Huh?");
response1.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=test");
- final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
+ final InputStream inStream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
response1.setEntity(EntityBuilder.create()
- .setStream(instream1)
+ .setStream(inStream1)
.build());
final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
- final InputStream instream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {2, 3, 4}));
+ final InputStream inStream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {2, 3, 4}));
response2.setEntity(EntityBuilder.create()
- .setStream(instream2)
+ .setStream(inStream2)
.build());
final HttpClientContext context = new HttpClientContext();
@@ -287,7 +287,7 @@ public class TestProtocolExec {
final ClassicHttpResponse finalResponse = protocolExec.execute(request, scope, chain);
Mockito.verify(chain, Mockito.times(2)).proceed(request, scope);
Mockito.verify(execRuntime).disconnect();
- Mockito.verify(instream2, Mockito.never()).close();
+ Mockito.verify(inStream2, Mockito.never()).close();
Assert.assertNotNull(finalResponse);
Assert.assertEquals(200, finalResponse.getCode());
@@ -299,15 +299,15 @@ public class TestProtocolExec {
final HttpRoute route = new HttpRoute(target);
final HttpClientContext context = new HttpClientContext();
final HttpPost request = new HttpPost("http://foo/test");
- final InputStream instream0 = new ByteArrayInputStream(new byte[] {1, 2, 3});
+ final InputStream inStream0 = new ByteArrayInputStream(new byte[] {1, 2, 3});
request.setEntity(EntityBuilder.create()
- .setStream(instream0)
+ .setStream(inStream0)
.build());
final ClassicHttpResponse response1 = new BasicClassicHttpResponse(401, "Huh?");
response1.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=test");
- final InputStream instream1 = new ByteArrayInputStream(new byte[] {1, 2, 3});
+ final InputStream inStream1 = new ByteArrayInputStream(new byte[] {1, 2, 3});
response1.setEntity(EntityBuilder.create()
- .setStream(instream1)
+ .setStream(inStream1)
.build());
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java
index 0a53ec7..d202fe1 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestRedirectExec.java
@@ -99,15 +99,15 @@ public class TestRedirectExec {
final ClassicHttpResponse response1 = Mockito.spy(new BasicClassicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY));
final URI redirect = new URI("http://localhost:80/redirect");
response1.setHeader(HttpHeaders.LOCATION, redirect.toASCIIString());
- final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
+ final InputStream inStream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
final HttpEntity entity1 = EntityBuilder.create()
- .setStream(instream1)
+ .setStream(inStream1)
.build();
response1.setEntity(entity1);
final ClassicHttpResponse response2 = Mockito.spy(new BasicClassicHttpResponse(HttpStatus.SC_OK));
- final InputStream instream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
+ final InputStream inStream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
final HttpEntity entity2 = EntityBuilder.create()
- .setStream(instream2)
+ .setStream(inStream2)
.build();
response2.setEntity(entity2);
@@ -130,9 +130,9 @@ public class TestRedirectExec {
Assert.assertSame(request, allValues.get(0));
Mockito.verify(response1, Mockito.times(1)).close();
- Mockito.verify(instream1, Mockito.times(2)).close();
+ Mockito.verify(inStream1, Mockito.times(2)).close();
Mockito.verify(response2, Mockito.never()).close();
- Mockito.verify(instream2, Mockito.never()).close();
+ Mockito.verify(inStream2, Mockito.never()).close();
}
@Test(expected = RedirectException.class)
@@ -332,9 +332,9 @@ public class TestRedirectExec {
final ClassicHttpResponse response1 = Mockito.spy(new BasicClassicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY));
final URI redirect = new URI("http://localhost:80/redirect");
response1.setHeader(HttpHeaders.LOCATION, redirect.toASCIIString());
- final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
+ final InputStream inStream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
final HttpEntity entity1 = EntityBuilder.create()
- .setStream(instream1)
+ .setStream(inStream1)
.build();
response1.setEntity(entity1);
Mockito.when(chain.proceed(
@@ -349,7 +349,7 @@ public class TestRedirectExec {
try {
redirectExec.execute(request, scope, chain);
} catch (final Exception ex) {
- Mockito.verify(instream1, Mockito.times(2)).close();
+ Mockito.verify(inStream1, Mockito.times(2)).close();
Mockito.verify(response1).close();
throw ex;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestResponseEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestResponseEntityWrapper.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestResponseEntityWrapper.java
index 46250cf..a8ad4e4 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestResponseEntityWrapper.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestResponseEntityWrapper.java
@@ -42,16 +42,16 @@ import org.mockito.Mockito;
@SuppressWarnings("boxing") // test code
public class TestResponseEntityWrapper {
- private InputStream instream;
+ private InputStream inStream;
private HttpEntity entity;
private ExecRuntime execRuntime;
private ResponseEntityProxy wrapper;
@Before
public void setup() throws Exception {
- instream = Mockito.mock(InputStream.class);
+ inStream = Mockito.mock(InputStream.class);
entity = Mockito.mock(HttpEntity.class);
- Mockito.when(entity.getContent()).thenReturn(instream);
+ Mockito.when(entity.getContent()).thenReturn(inStream);
execRuntime = Mockito.mock(ExecRuntime.class);
wrapper = new ResponseEntityProxy(entity, execRuntime);
}
@@ -62,7 +62,7 @@ public class TestResponseEntityWrapper {
Mockito.when(execRuntime.isConnectionReusable()).thenReturn(true);
EntityUtils.consume(wrapper);
- Mockito.verify(instream, Mockito.times(1)).close();
+ Mockito.verify(inStream, Mockito.times(1)).close();
Mockito.verify(execRuntime).releaseConnection();
}
@@ -70,7 +70,7 @@ public class TestResponseEntityWrapper {
public void testReusableEntityStreamClosedIOError() throws Exception {
Mockito.when(entity.isStreaming()).thenReturn(true);
Mockito.when(execRuntime.isConnectionReusable()).thenReturn(true);
- Mockito.doThrow(new IOException()).when(instream).close();
+ Mockito.doThrow(new IOException()).when(inStream).close();
try {
EntityUtils.consume(wrapper);
Assert.fail("IOException expected");
@@ -84,28 +84,28 @@ public class TestResponseEntityWrapper {
Mockito.when(entity.isStreaming()).thenReturn(true);
Mockito.when(execRuntime.isConnectionReusable()).thenReturn(true);
Mockito.when(execRuntime.isConnectionAcquired()).thenReturn(false);
- Mockito.doThrow(new SocketException()).when(instream).close();
+ Mockito.doThrow(new SocketException()).when(inStream).close();
EntityUtils.consume(wrapper);
Mockito.verify(execRuntime).discardConnection();
}
@Test
public void testReusableEntityWriteTo() throws Exception {
- final OutputStream outstream = Mockito.mock(OutputStream.class);
+ final OutputStream outStream = Mockito.mock(OutputStream.class);
Mockito.when(entity.isStreaming()).thenReturn(true);
Mockito.when(execRuntime.isConnectionReusable()).thenReturn(true);
- wrapper.writeTo(outstream);
+ wrapper.writeTo(outStream);
Mockito.verify(execRuntime).releaseConnection();
}
@Test
public void testReusableEntityWriteToIOError() throws Exception {
- final OutputStream outstream = Mockito.mock(OutputStream.class);
+ final OutputStream outStream = Mockito.mock(OutputStream.class);
Mockito.when(entity.isStreaming()).thenReturn(true);
Mockito.when(execRuntime.isConnectionReusable()).thenReturn(true);
- Mockito.doThrow(new IOException()).when(entity).writeTo(outstream);
+ Mockito.doThrow(new IOException()).when(entity).writeTo(outStream);
try {
- wrapper.writeTo(outstream);
+ wrapper.writeTo(outStream);
Assert.fail("IOException expected");
} catch (final IOException ex) {
}
@@ -115,21 +115,21 @@ public class TestResponseEntityWrapper {
@Test
public void testReusableEntityEndOfStream() throws Exception {
- Mockito.when(instream.read()).thenReturn(-1);
+ Mockito.when(inStream.read()).thenReturn(-1);
Mockito.when(entity.isStreaming()).thenReturn(true);
Mockito.when(execRuntime.isConnectionReusable()).thenReturn(true);
final InputStream content = wrapper.getContent();
Assert.assertEquals(-1, content.read());
- Mockito.verify(instream).close();
+ Mockito.verify(inStream).close();
Mockito.verify(execRuntime).releaseConnection();
}
@Test
public void testReusableEntityEndOfStreamIOError() throws Exception {
- Mockito.when(instream.read()).thenReturn(-1);
+ Mockito.when(inStream.read()).thenReturn(-1);
Mockito.when(entity.isStreaming()).thenReturn(true);
Mockito.when(execRuntime.isConnectionReusable()).thenReturn(true);
- Mockito.doThrow(new IOException()).when(instream).close();
+ Mockito.doThrow(new IOException()).when(inStream).close();
final InputStream content = wrapper.getContent();
try {
content.read();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java
index 69eac44..ed2c1e1 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java
@@ -75,13 +75,13 @@ public class TestBasicClientCookie {
orig.setPath("/");
orig.setAttribute("attrib", "stuff");
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
- final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer);
- outstream.writeObject(orig);
- outstream.close();
+ final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer);
+ outStream.writeObject(orig);
+ outStream.close();
final byte[] raw = outbuffer.toByteArray();
- final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
- final ObjectInputStream instream = new ObjectInputStream(inbuffer);
- final BasicClientCookie clone = (BasicClientCookie) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final BasicClientCookie clone = (BasicClientCookie) inStream.readObject();
Assert.assertEquals(orig.getName(), clone.getName());
Assert.assertEquals(orig.getValue(), clone.getValue());
Assert.assertEquals(orig.getDomain(), clone.getDomain());
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1c707507/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieStore.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieStore.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieStore.java
index f01f609..ed2cea2 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieStore.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieStore.java
@@ -49,15 +49,15 @@ public class TestBasicCookieStore {
final BasicCookieStore store = new BasicCookieStore();
store.addCookie(new BasicClientCookie("name1", "value1"));
store.addCookies(new BasicClientCookie[] {new BasicClientCookie("name2", "value2")});
- List<Cookie> l = store.getCookies();
- Assert.assertNotNull(l);
- Assert.assertEquals(2, l.size());
- Assert.assertEquals("name1", l.get(0).getName());
- Assert.assertEquals("name2", l.get(1).getName());
+ List<Cookie> list = store.getCookies();
+ Assert.assertNotNull(list);
+ Assert.assertEquals(2, list.size());
+ Assert.assertEquals("name1", list.get(0).getName());
+ Assert.assertEquals("name2", list.get(1).getName());
store.clear();
- l = store.getCookies();
- Assert.assertNotNull(l);
- Assert.assertEquals(0, l.size());
+ list = store.getCookies();
+ Assert.assertNotNull(list);
+ Assert.assertEquals(0, list.size());
}
@Test
@@ -69,9 +69,9 @@ public class TestBasicCookieStore {
c.add(Calendar.DAY_OF_YEAR, -10);
cookie.setExpiryDate(c.getTime());
store.addCookie(cookie);
- final List<Cookie> l = store.getCookies();
- Assert.assertNotNull(l);
- Assert.assertEquals(0, l.size());
+ final List<Cookie> list = store.getCookies();
+ Assert.assertNotNull(list);
+ Assert.assertEquals(0, list.size());
}
@Test
@@ -80,13 +80,13 @@ public class TestBasicCookieStore {
orig.addCookie(new BasicClientCookie("name1", "value1"));
orig.addCookie(new BasicClientCookie("name2", "value2"));
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
- final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer);
- outstream.writeObject(orig);
- outstream.close();
+ final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer);
+ outStream.writeObject(orig);
+ outStream.close();
final byte[] raw = outbuffer.toByteArray();
- final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
- final ObjectInputStream instream = new ObjectInputStream(inbuffer);
- final BasicCookieStore clone = (BasicCookieStore) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final BasicCookieStore clone = (BasicCookieStore) inStream.readObject();
final List<Cookie> expected = orig.getCookies();
final List<Cookie> clones = clone.getCookies();
Assert.assertNotNull(expected);