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:54:56 UTC
[3/3] httpcomponents-core 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
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-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/34603734
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/34603734
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/34603734
Branch: refs/heads/master
Commit: 34603734253ad3bbf84368370ffa91f7b019af39
Parents: 7e07b8f
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Aug 13 16:54:47 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Mon Aug 13 16:54:47 2018 -0600
----------------------------------------------------------------------
.../core5/http2/impl/io/FrameInputBuffer.java | 10 +-
.../core5/http2/impl/io/FrameOutputBuffer.java | 4 +-
.../http2/impl/io/TestFrameInOutBuffers.java | 42 ++---
.../http2/impl/nio/TestFrameInOutBuffers.java | 48 +++---
.../hc/core5/benchmark/BenchmarkConnection.java | 4 +-
.../hc/core5/benchmark/BenchmarkWorker.java | 6 +-
.../hc/core5/benchmark/CountingInputStream.java | 4 +-
.../core5/benchmark/CountingOutputStream.java | 4 +-
.../testing/classic/ClassicIntegrationTest.java | 16 +-
.../framework/TestClientPOJOAdapter.java | 82 ---------
.../framework/TestClientPojoAdapter.java | 82 +++++++++
.../http/examples/AsyncReverseProxyExample.java | 4 +-
.../org/apache/hc/core5/http/HttpEntity.java | 4 +-
.../http/impl/bootstrap/HttpRequester.java | 6 +-
.../http/impl/io/AbstractMessageParser.java | 16 +-
.../core5/http/impl/io/BHttpConnectionBase.java | 16 +-
.../http/impl/io/ContentLengthInputStream.java | 8 +-
.../http/impl/io/ContentLengthOutputStream.java | 4 +-
.../impl/io/DefaultBHttpClientConnection.java | 16 +-
.../impl/io/DefaultBHttpServerConnection.java | 8 +-
.../http/impl/io/SessionInputBufferImpl.java | 14 +-
.../http/impl/io/SessionOutputBufferImpl.java | 18 +-
.../core5/http/impl/nio/ExpandableBuffer.java | 6 +-
.../http/impl/nio/SessionInputBufferImpl.java | 44 ++---
.../http/impl/nio/SessionOutputBufferImpl.java | 42 ++---
.../hc/core5/http/io/EofSensorInputStream.java | 16 +-
.../io/entity/AbstractImmutableHttpEntity.java | 14 +-
.../core5/http/io/entity/BasicHttpEntity.java | 6 +-
.../http/io/entity/BufferedHttpEntity.java | 8 +-
.../core5/http/io/entity/ByteArrayEntity.java | 8 +-
.../core5/http/io/entity/ByteBufferEntity.java | 8 +-
.../hc/core5/http/io/entity/EntityUtils.java | 30 ++--
.../http/io/entity/HttpContentProducer.java | 2 +-
.../http/io/entity/HttpEntityWithTrailers.java | 4 +-
.../core5/http/io/entity/HttpEntityWrapper.java | 4 +-
.../core5/http/io/entity/InputStreamEntity.java | 58 +++----
.../http/io/entity/SerializableEntity.java | 10 +-
.../hc/core5/http/io/entity/StringEntity.java | 8 +-
.../http/nio/entity/SharedInputBuffer.java | 4 +-
.../http/nio/entity/SharedOutputBuffer.java | 4 +-
.../apache/hc/core5/ssl/SSLContextBuilder.java | 16 +-
.../org/apache/hc/core5/http/TestHttpHost.java | 12 +-
.../apache/hc/core5/http/TestHttpVersion.java | 12 +-
.../http/impl/io/TestBHttpConnectionBase.java | 84 ++++-----
.../hc/core5/http/impl/io/TestChunkCoding.java | 84 ++++-----
.../impl/io/TestContentLengthInputStream.java | 34 ++--
.../io/TestDefaultBHttpClientConnection.java | 66 +++----
.../io/TestDefaultBHttpServerConnection.java | 54 +++---
.../hc/core5/http/impl/io/TestHttpService.java | 12 +-
.../http/impl/io/TestIdentityInputStream.java | 16 +-
.../core5/http/impl/io/TestMessageParser.java | 32 ++--
.../core5/http/impl/io/TestRequestParser.java | 20 +--
.../core5/http/impl/io/TestResponseParser.java | 20 +--
.../http/impl/io/TestSessionInOutBuffers.java | 172 +++++++++----------
.../http/impl/nio/TestSessionInOutBuffers.java | 52 +++---
.../core5/http/io/TestEofSensorInputStream.java | 46 ++---
.../hc/core5/http/io/entity/TestFileEntity.java | 12 +-
.../http/io/entity/TestInputStreamEntity.java | 26 +--
.../core5/http/message/TestBufferedHeader.java | 12 +-
.../hc/core5/http/message/TestHeader.java | 12 +-
.../hc/core5/http/message/TestHeaderGroup.java | 12 +-
.../java/org/apache/hc/core5/net/TestHost.java | 12 +-
.../apache/hc/core5/net/TestURIAuthority.java | 12 +-
.../hc/core5/util/TestByteArrayBuffer.java | 10 +-
.../hc/core5/util/TestCharArrayBuffer.java | 10 +-
65 files changed, 771 insertions(+), 771 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java
index 1b0f001..60ea590 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java
@@ -77,13 +77,13 @@ public final class FrameInputBuffer {
return this.dataLen > 0;
}
- void fillBuffer(final InputStream instream, final int requiredLen) throws IOException {
+ void fillBuffer(final InputStream inStream, final int requiredLen) throws IOException {
while (dataLen < requiredLen) {
if (off > 0) {
System.arraycopy(buffer, off, buffer, 0, dataLen);
off = 0;
}
- final int bytesRead = instream.read(buffer, off + dataLen, buffer.length - dataLen);
+ final int bytesRead = inStream.read(buffer, off + dataLen, buffer.length - dataLen);
if (bytesRead == -1) {
if (dataLen > 0) {
throw new H2CorruptFrameException("Corrupt or incomplete HTTP2 frame");
@@ -95,9 +95,9 @@ public final class FrameInputBuffer {
}
}
- public RawFrame read(final InputStream instream) throws IOException {
+ public RawFrame read(final InputStream inStream) throws IOException {
- fillBuffer(instream, FrameConsts.HEAD_LEN);
+ fillBuffer(inStream, FrameConsts.HEAD_LEN);
final int payloadOff = FrameConsts.HEAD_LEN;
final int payloadLen = (buffer[off] & 0xff) << 16 | (buffer[off + 1] & 0xff) << 8 | (buffer[off + 2] & 0xff);
@@ -109,7 +109,7 @@ public final class FrameInputBuffer {
}
final int frameLen = payloadOff + payloadLen;
- fillBuffer(instream, frameLen);
+ fillBuffer(inStream, frameLen);
if ((flags & FrameFlag.PADDED.getValue()) > 0) {
if (payloadLen == 0) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java
index dba9181..93d26ee 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java
@@ -64,7 +64,7 @@ public final class FrameOutputBuffer {
this(new BasicH2TransportMetrics(), maxFramePayloadSize);
}
- public void write(final RawFrame frame, final OutputStream outstream) throws IOException {
+ public void write(final RawFrame frame, final OutputStream outStream) throws IOException {
if (frame == null) {
return;
}
@@ -102,7 +102,7 @@ public final class FrameOutputBuffer {
for (int i = 0; i < padding; i++) {
buffer[frameLen++] = 0;
}
- outstream.write(buffer, 0, frameLen);
+ outStream.write(buffer, 0, frameLen);
metrics.incrementFramesTransferred();
metrics.incrementBytesTransferred(frameLen);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestFrameInOutBuffers.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestFrameInOutBuffers.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestFrameInOutBuffers.java
index 29a2727..68e803a 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestFrameInOutBuffers.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestFrameInOutBuffers.java
@@ -53,7 +53,7 @@ public class TestFrameInOutBuffers {
ByteBuffer.wrap(new byte[]{1,2,3,4,5}));
outbuffer.write(frame, outputStream);
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final byte[] bytes = outputStream.toByteArray();
final ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
Assert.assertEquals(FrameConsts.HEAD_LEN + 5, bytes.length);
@@ -61,7 +61,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(1, outbuffer.getMetrics().getFramesTransferred());
Assert.assertEquals(bytes.length, outbuffer.getMetrics().getBytesTransferred());
- final RawFrame frame2 = inbuffer.read(inputStream);
+ final RawFrame frame2 = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA.getValue(), frame2.getType());
Assert.assertEquals(0, frame2.getFlags());
Assert.assertEquals(1L, frame2.getStreamId());
@@ -75,20 +75,20 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(5, payload2.get());
Assert.assertEquals(-1, inputStream.read());
- Assert.assertEquals(1, inbuffer.getMetrics().getFramesTransferred());
- Assert.assertEquals(bytes.length, inbuffer.getMetrics().getBytesTransferred());
+ Assert.assertEquals(1, inBuffer.getMetrics().getFramesTransferred());
+ Assert.assertEquals(bytes.length, inBuffer.getMetrics().getBytesTransferred());
}
@Test
public void testReadFrameMultiple() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(
new byte[] {
0,0,10,0,8,0,0,0,8,4,0,1,2,3,4,0,0,0,0,
0,0,10,0,9,0,0,0,8,4,5,6,7,8,9,0,0,0,0
});
- final RawFrame frame1 = inbuffer.read(inputStream);
+ final RawFrame frame1 = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame1.getType()));
Assert.assertEquals(8, frame1.getFlags());
Assert.assertEquals(8, frame1.getStreamId());
@@ -101,7 +101,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(3, payload1.get());
Assert.assertEquals(4, payload1.get());
- final RawFrame frame2 = inbuffer.read(inputStream);
+ final RawFrame frame2 = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame2.getType()));
Assert.assertEquals(FrameFlag.of(FrameFlag.END_STREAM, FrameFlag.PADDED), frame2.getFlags());
Assert.assertEquals(8, frame2.getStreamId());
@@ -119,7 +119,7 @@ public class TestFrameInOutBuffers {
@Test
public void testReadFrameMultipleSmallBuffer() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(new BasicH2TransportMetrics(), 20, 10);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(new BasicH2TransportMetrics(), 20, 10);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(
new byte[] {
0,0,10,0,8,0,0,0,8,4,1,1,1,1,1,0,0,0,0,
@@ -127,7 +127,7 @@ public class TestFrameInOutBuffers {
0,0,10,0,9,0,0,0,8,4,3,3,3,3,3,0,0,0,0
});
- final RawFrame frame1 = inbuffer.read(inputStream);
+ final RawFrame frame1 = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame1.getType()));
Assert.assertEquals(8, frame1.getFlags());
Assert.assertEquals(8, frame1.getStreamId());
@@ -140,7 +140,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(1, payload1.get());
Assert.assertEquals(1, payload1.get());
- final RawFrame frame2 = inbuffer.read(inputStream);
+ final RawFrame frame2 = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame2.getType()));
Assert.assertEquals(0, frame2.getFlags());
Assert.assertEquals(8, frame2.getStreamId());
@@ -153,7 +153,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(2, payload2.get());
Assert.assertEquals(2, payload2.get());
- final RawFrame frame3 = inbuffer.read(inputStream);
+ final RawFrame frame3 = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame3.getType()));
Assert.assertEquals(FrameFlag.of(FrameFlag.END_STREAM, FrameFlag.PADDED), frame3.getFlags());
Assert.assertEquals(8, frame3.getStreamId());
@@ -171,7 +171,7 @@ public class TestFrameInOutBuffers {
@Test
public void testReadFramePartialReads() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final MultiByteArrayInputStream inputStream = new MultiByteArrayInputStream(
new byte[] {0,0},
new byte[] {10,0,9,0},
@@ -181,7 +181,7 @@ public class TestFrameInOutBuffers {
new byte[] {5,0},
new byte[] {0,0,0});
- final RawFrame frame = inbuffer.read(inputStream);
+ final RawFrame frame = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame.getType()));
Assert.assertEquals(FrameFlag.of(FrameFlag.END_STREAM, FrameFlag.PADDED), frame.getFlags());
Assert.assertEquals(8, frame.getStreamId());
@@ -198,10 +198,10 @@ public class TestFrameInOutBuffers {
@Test
public void testReadEmptyFrame() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] {0,0,0,0,0,0,0,0,0});
- final RawFrame frame = inbuffer.read(inputStream);
+ final RawFrame frame = inBuffer.read(inputStream);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame.getType()));
Assert.assertEquals(0, frame.getFlags());
Assert.assertEquals(0, frame.getStreamId());
@@ -211,18 +211,18 @@ public class TestFrameInOutBuffers {
@Test(expected = ConnectionClosedException.class)
public void testReadFrameConnectionClosed() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] {});
- inbuffer.read(inputStream);
+ inBuffer.read(inputStream);
}
@Test(expected = H2CorruptFrameException.class)
public void testReadFrameCorruptFrame() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] {0,0});
- inbuffer.read(inputStream);
+ inBuffer.read(inputStream);
}
@Test(expected = H2ConnectionException.class)
@@ -237,11 +237,11 @@ public class TestFrameInOutBuffers {
@Test(expected = H2ConnectionException.class)
public void testReadFrameExceedingLimit() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(
new byte[] {0,-128,-128,0,0,0,0,0,1});
- inbuffer.read(inputStream);
+ inBuffer.read(inputStream);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
index d3693d9..c9e8603 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
@@ -53,7 +53,7 @@ public class TestFrameInOutBuffers {
ByteBuffer.wrap(new byte[]{1,2,3,4,5}));
outbuffer.write(frame, writableChannel);
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final byte[] bytes = writableChannel.toByteArray();
Assert.assertEquals(FrameConsts.HEAD_LEN + 5, bytes.length);
@@ -61,7 +61,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(bytes.length, outbuffer.getMetrics().getBytesTransferred());
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(bytes);
- final RawFrame frame2 = inbuffer.read(readableChannel);
+ final RawFrame frame2 = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA.getValue(), frame2.getType());
Assert.assertEquals(0, frame2.getFlags());
Assert.assertEquals(1L, frame2.getStreamId());
@@ -75,8 +75,8 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(5, payload2.get());
Assert.assertEquals(-1, readableChannel.read(ByteBuffer.allocate(1024)));
- Assert.assertEquals(1, inbuffer.getMetrics().getFramesTransferred());
- Assert.assertEquals(bytes.length, inbuffer.getMetrics().getBytesTransferred());
+ Assert.assertEquals(1, inBuffer.getMetrics().getFramesTransferred());
+ Assert.assertEquals(bytes.length, inBuffer.getMetrics().getBytesTransferred());
}
@Test
@@ -103,14 +103,14 @@ public class TestFrameInOutBuffers {
@Test
public void testReadFrameMultiple() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(
new byte[] {
0,0,10,0,8,0,0,0,8,4,0,1,2,3,4,0,0,0,0,
0,0,10,0,9,0,0,0,8,4,5,6,7,8,9,0,0,0,0
});
- final RawFrame frame1 = inbuffer.read(readableChannel);
+ final RawFrame frame1 = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame1.getType()));
Assert.assertEquals(8, frame1.getFlags());
Assert.assertEquals(8, frame1.getStreamId());
@@ -123,7 +123,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(3, payload1.get());
Assert.assertEquals(4, payload1.get());
- final RawFrame frame2 = inbuffer.read(readableChannel);
+ final RawFrame frame2 = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame2.getType()));
Assert.assertEquals(FrameFlag.of(FrameFlag.END_STREAM, FrameFlag.PADDED), frame2.getFlags());
Assert.assertEquals(8, frame2.getStreamId());
@@ -141,7 +141,7 @@ public class TestFrameInOutBuffers {
@Test
public void testReadFrameMultipleSmallBuffer() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(new BasicH2TransportMetrics(), 20, 10);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(new BasicH2TransportMetrics(), 20, 10);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(
new byte[] {
0,0,10,0,8,0,0,0,8,4,1,1,1,1,1,0,0,0,0,
@@ -149,7 +149,7 @@ public class TestFrameInOutBuffers {
0,0,10,0,9,0,0,0,8,4,3,3,3,3,3,0,0,0,0
});
- final RawFrame frame1 = inbuffer.read(readableChannel);
+ final RawFrame frame1 = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame1.getType()));
Assert.assertEquals(8, frame1.getFlags());
Assert.assertEquals(8, frame1.getStreamId());
@@ -162,7 +162,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(1, payload1.get());
Assert.assertEquals(1, payload1.get());
- final RawFrame frame2 = inbuffer.read(readableChannel);
+ final RawFrame frame2 = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame2.getType()));
Assert.assertEquals(0, frame2.getFlags());
Assert.assertEquals(8, frame2.getStreamId());
@@ -175,7 +175,7 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(2, payload2.get());
Assert.assertEquals(2, payload2.get());
- final RawFrame frame3 = inbuffer.read(readableChannel);
+ final RawFrame frame3 = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame3.getType()));
Assert.assertEquals(FrameFlag.of(FrameFlag.END_STREAM, FrameFlag.PADDED), frame3.getFlags());
Assert.assertEquals(8, frame3.getStreamId());
@@ -193,7 +193,7 @@ public class TestFrameInOutBuffers {
@Test
public void testReadFramePartialReads() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(
new byte[] {0,0},
new byte[] {10,0,9,0},
@@ -203,7 +203,7 @@ public class TestFrameInOutBuffers {
new byte[] {5,0},
new byte[] {0,0,0});
- final RawFrame frame = inbuffer.read(readableChannel);
+ final RawFrame frame = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame.getType()));
Assert.assertEquals(FrameFlag.of(FrameFlag.END_STREAM, FrameFlag.PADDED), frame.getFlags());
Assert.assertEquals(8, frame.getStreamId());
@@ -221,11 +221,11 @@ public class TestFrameInOutBuffers {
@Test
public void testReadEmptyFrame() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(
new byte[] {0,0,0,0,0,0,0,0,0});
- final RawFrame frame = inbuffer.read(readableChannel);
+ final RawFrame frame = inBuffer.read(readableChannel);
Assert.assertEquals(FrameType.DATA, FrameType.valueOf(frame.getType()));
Assert.assertEquals(0, frame.getFlags());
Assert.assertEquals(0, frame.getStreamId());
@@ -235,20 +235,20 @@ public class TestFrameInOutBuffers {
@Test(expected = ConnectionClosedException.class)
public void testReadFrameConnectionClosed() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(new byte[] {});
- Assert.assertEquals(null, inbuffer.read(readableChannel));
- inbuffer.read(readableChannel);
+ Assert.assertEquals(null, inBuffer.read(readableChannel));
+ inBuffer.read(readableChannel);
}
@Test(expected = H2CorruptFrameException.class)
public void testReadFrameCorruptFrame() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(new byte[] {0,0});
- Assert.assertEquals(null, inbuffer.read(readableChannel));
- inbuffer.read(readableChannel);
+ Assert.assertEquals(null, inBuffer.read(readableChannel));
+ inBuffer.read(readableChannel);
}
@Test(expected = H2ConnectionException.class)
@@ -263,12 +263,12 @@ public class TestFrameInOutBuffers {
@Test(expected = H2ConnectionException.class)
public void testReadFrameExceedingLimit() throws Exception {
- final FrameInputBuffer inbuffer = new FrameInputBuffer(16 * 1024);
+ final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(
new byte[] {0,-128,-128,0,0,0,0,0,1});
- Assert.assertEquals(null, inbuffer.read(readableChannel));
- inbuffer.read(readableChannel);
+ Assert.assertEquals(null, inBuffer.read(readableChannel));
+ inBuffer.read(readableChannel);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkConnection.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkConnection.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkConnection.java
index cd86cf3..3b027b4 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkConnection.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkConnection.java
@@ -58,9 +58,9 @@ class BenchmarkConnection extends DefaultBHttpClientConnection {
@Override
protected InputStream createContentInputStream(final long len,
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final InputStream inputStream) {
- return new CountingInputStream(super.createContentInputStream(len, inbuffer, inputStream), this.stats);
+ return new CountingInputStream(super.createContentInputStream(len, inBuffer, inputStream), this.stats);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkWorker.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkWorker.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkWorker.java
index 4715bc5..a1b7eca 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkWorker.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/BenchmarkWorker.java
@@ -182,16 +182,16 @@ class BenchmarkWorker implements Runnable {
charset = StandardCharsets.ISO_8859_1;
}
long contentlen = 0;
- final InputStream instream = entity.getContent();
+ final InputStream inStream = entity.getContent();
int l;
- while ((l = instream.read(this.buffer)) != -1) {
+ while ((l = inStream.read(this.buffer)) != -1) {
contentlen += l;
if (config.getVerbosity() >= 4) {
final String s = new String(this.buffer, 0, l, charset);
System.out.print(s);
}
}
- instream.close();
+ inStream.close();
stats.setContentLength(contentlen);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingInputStream.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingInputStream.java
index b64d7b8..ff8b4f6 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingInputStream.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingInputStream.java
@@ -34,8 +34,8 @@ class CountingInputStream extends FilterInputStream {
private final Stats stats;
- CountingInputStream(final InputStream instream, final Stats stats) {
- super(instream);
+ CountingInputStream(final InputStream inStream, final Stats stats) {
+ super(inStream);
this.stats = stats;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingOutputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingOutputStream.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingOutputStream.java
index a47c537..c514797 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingOutputStream.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/CountingOutputStream.java
@@ -34,8 +34,8 @@ class CountingOutputStream extends FilterOutputStream {
private final Stats stats;
- CountingOutputStream(final OutputStream outstream, final Stats stats) {
- super(outstream);
+ CountingOutputStream(final OutputStream outStream, final Stats stats) {
+ super(outStream);
this.stats = stats;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
index dd70af6..aa80ebc 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicIntegrationTest.java
@@ -574,13 +574,13 @@ public class ClassicIntegrationTest {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
+ public void writeTo(final OutputStream outStream) throws IOException {
for (int i = 0; i < this.n; i++) {
- outstream.write(this.raw);
- outstream.write('\r');
- outstream.write('\n');
+ outStream.write(this.raw);
+ outStream.write('\r');
+ outStream.write('\n');
}
- outstream.flush();
+ outStream.flush();
}
@Override
@@ -670,14 +670,14 @@ public class ClassicIntegrationTest {
try (final ClassicHttpResponse response = this.client.execute(host, post, context)) {
final HttpEntity incoming = response.getEntity();
Assert.assertNotNull(incoming);
- final InputStream instream = incoming.getContent();
+ final InputStream inStream = incoming.getContent();
final ContentType contentType = EntityUtils.getContentTypeOrDefault(incoming);
Charset charset = contentType.getCharset();
if (charset == null) {
charset = StandardCharsets.ISO_8859_1;
}
- Assert.assertNotNull(instream);
- final BufferedReader reader = new BufferedReader(new InputStreamReader(instream, charset));
+ Assert.assertNotNull(inStream);
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, charset));
String line;
int count = 0;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
deleted file mode 100644
index 132e0ce..0000000
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.core5.testing.framework;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestClientPOJOAdapter {
- @Test
- public void modifyRequest() throws Exception {
- final ClientPOJOAdapter adapter = new ClassicTestClientAdapter();
- final Map<String, Object> request = new HashMap<>();
- final Map<String, Object> request2 = adapter.modifyRequest(request);
-
- Assert.assertSame("request should have been returned", request, request2);
- }
-
- @Test
- public void checkRequestSupport() throws Exception {
- final ClientPOJOAdapter adapter = new ClassicTestClientAdapter();
- final String reason = adapter.checkRequestSupport(null);
-
- Assert.assertNull("reason should be null", reason);
-
- adapter.assertRequestSupported(null);
- }
-
- @Test
- public void checkRequestSupportThrows() throws Exception {
- final ClientPOJOAdapter adapter = new ClientPOJOAdapter() {
-
- @Override
- public Map<String, Object> execute(final String defaultURI, final Map<String, Object> request) throws Exception {
- return null;
- }
-
- @Override
- public String checkRequestSupport(final java.util.Map<String,Object> request) {
- return "A reason this request is not supported.";
- }
-
- @Override
- public String getClientName() {
- return null;
- }
- };
-
- try {
- adapter.assertRequestSupported(null);
- Assert.fail("A Exception should have been thrown");
- } catch (final Exception e) {
- // expected
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPojoAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPojoAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPojoAdapter.java
new file mode 100644
index 0000000..bcaf6a2
--- /dev/null
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPojoAdapter.java
@@ -0,0 +1,82 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.hc.core5.testing.framework;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestClientPojoAdapter {
+ @Test
+ public void modifyRequest() throws Exception {
+ final ClientPOJOAdapter adapter = new ClassicTestClientAdapter();
+ final Map<String, Object> request = new HashMap<>();
+ final Map<String, Object> request2 = adapter.modifyRequest(request);
+
+ Assert.assertSame("request should have been returned", request, request2);
+ }
+
+ @Test
+ public void checkRequestSupport() throws Exception {
+ final ClientPOJOAdapter adapter = new ClassicTestClientAdapter();
+ final String reason = adapter.checkRequestSupport(null);
+
+ Assert.assertNull("reason should be null", reason);
+
+ adapter.assertRequestSupported(null);
+ }
+
+ @Test
+ public void checkRequestSupportThrows() throws Exception {
+ final ClientPOJOAdapter adapter = new ClientPOJOAdapter() {
+
+ @Override
+ public Map<String, Object> execute(final String defaultURI, final Map<String, Object> request) throws Exception {
+ return null;
+ }
+
+ @Override
+ public String checkRequestSupport(final java.util.Map<String,Object> request) {
+ return "A reason this request is not supported.";
+ }
+
+ @Override
+ public String getClientName() {
+ return null;
+ }
+ };
+
+ try {
+ adapter.assertRequestSupported(null);
+ Assert.fail("A Exception should have been thrown");
+ } catch (final Exception e) {
+ // expected
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
index 85ce597..8f7a78e 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
@@ -200,8 +200,8 @@ public class AsyncReverseProxyExample {
private static class ProxyBuffer extends ExpandableBuffer {
- ProxyBuffer(int buffersize) {
- super(buffersize);
+ ProxyBuffer(int bufferSize) {
+ super(bufferSize);
}
void put(final ByteBuffer src) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
index 5968467..32f6605 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
@@ -107,11 +107,11 @@ public interface HttpEntity extends EntityDetails, Closeable {
* returns.
* </p>
*
- * @param outstream the output stream to write entity content to
+ * @param outStream the output stream to write entity content to
*
* @throws IOException if an I/O error occurs
*/
- void writeTo(OutputStream outstream) throws IOException;
+ void writeTo(OutputStream outStream) throws IOException;
/**
* Tells whether this entity depends on an underlying stream.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
index 0aca058..16c8dc3 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
@@ -332,10 +332,10 @@ public class HttpRequester implements ConnPoolControl<HttpHost>, ModalCloseable
}
@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);
}
close();
} catch (final IOException | RuntimeException ex) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/AbstractMessageParser.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/AbstractMessageParser.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/AbstractMessageParser.java
index ff8bc68..173f340 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/AbstractMessageParser.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/AbstractMessageParser.java
@@ -90,7 +90,7 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* Parses HTTP headers from the data receiver stream according to the generic
* format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3.
*
- * @param inbuffer Session input buffer
+ * @param inBuffer Session input buffer
* @param inputStream Input stream
* @param maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
@@ -107,13 +107,13 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* @throws HttpException in case of HTTP protocol violation
*/
public static Header[] parseHeaders(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final InputStream inputStream,
final int maxHeaderCount,
final int maxLineLen,
final LineParser lineParser) throws HttpException, IOException {
final List<CharArrayBuffer> headerLines = new ArrayList<>();
- return parseHeaders(inbuffer, inputStream, maxHeaderCount, maxLineLen,
+ return parseHeaders(inBuffer, inputStream, maxHeaderCount, maxLineLen,
lineParser != null ? lineParser : LazyLineParser.INSTANCE, headerLines);
}
@@ -121,7 +121,7 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* Parses HTTP headers from the data receiver stream according to the generic
* format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3.
*
- * @param inbuffer Session input buffer
+ * @param inBuffer Session input buffer
* @param inputStream Input stream
* @param maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
@@ -143,13 +143,13 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* @since 4.1
*/
public static Header[] parseHeaders(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final InputStream inputStream,
final int maxHeaderCount,
final int maxLineLen,
final LineParser parser,
final List<CharArrayBuffer> headerLines) throws HttpException, IOException {
- Args.notNull(inbuffer, "Session input buffer");
+ Args.notNull(inBuffer, "Session input buffer");
Args.notNull(inputStream, "Input stream");
Args.notNull(parser, "Line parser");
Args.notNull(headerLines, "Header line list");
@@ -162,8 +162,8 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
} else {
current.clear();
}
- final int l = inbuffer.readLine(current, inputStream);
- if (l == -1 || current.length() < 1) {
+ final int readLen = inBuffer.readLine(current, inputStream);
+ if (readLen == -1 || current.length() < 1) {
break;
}
// Parse the header name and value
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
index f2d1603..40c639a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
@@ -66,7 +66,7 @@ import org.apache.hc.core5.io.Closer;
class BHttpConnectionBase implements BHttpConnection {
final H1Config h1Config;
- final SessionInputBufferImpl inbuffer;
+ final SessionInputBufferImpl inBuffer;
final SessionOutputBufferImpl outbuffer;
final BasicHttpConnectionMetrics connMetrics;
final AtomicReference<SocketHolder> socketHolderRef;
@@ -81,7 +81,7 @@ class BHttpConnectionBase implements BHttpConnection {
this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
final BasicHttpTransportMetrics inTransportMetrics = new BasicHttpTransportMetrics();
final BasicHttpTransportMetrics outTransportMetrics = new BasicHttpTransportMetrics();
- this.inbuffer = new SessionInputBufferImpl(inTransportMetrics,
+ this.inBuffer = new SessionInputBufferImpl(inTransportMetrics,
this.h1Config.getBufferSize(), -1,
this.h1Config.getMaxLineLength(), chardecoder);
this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics,
@@ -169,11 +169,11 @@ class BHttpConnectionBase implements BHttpConnection {
HttpEntity createIncomingEntity(
final HttpMessage message,
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final InputStream inputStream,
final long len) {
return new IncomingHttpEntity(
- createContentInputStream(len, inbuffer, inputStream),
+ createContentInputStream(len, inBuffer, inputStream),
len >= 0 ? len : -1, len == ContentLengthStrategy.CHUNKED,
message.getFirstHeader(HttpHeaders.CONTENT_TYPE),
message.getFirstHeader(HttpHeaders.CONTENT_ENCODING));
@@ -240,7 +240,7 @@ class BHttpConnectionBase implements BHttpConnection {
final SocketHolder socketHolder = this.socketHolderRef.getAndSet(null);
if (socketHolder != null) {
try (final Socket socket = socketHolder.getSocket()) {
- this.inbuffer.clear();
+ this.inBuffer.clear();
this.outbuffer.flush(socketHolder.getOutputStream());
try {
try {
@@ -264,18 +264,18 @@ class BHttpConnectionBase implements BHttpConnection {
final int oldtimeout = socket.getSoTimeout();
try {
socket.setSoTimeout(timeout);
- return this.inbuffer.fillBuffer(socketHolder.getInputStream());
+ return this.inBuffer.fillBuffer(socketHolder.getInputStream());
} finally {
socket.setSoTimeout(oldtimeout);
}
}
protected boolean awaitInput(final int timeout) throws IOException {
- if (this.inbuffer.hasBufferedData()) {
+ if (this.inBuffer.hasBufferedData()) {
return true;
}
fillInputBuffer(timeout);
- return this.inbuffer.hasBufferedData();
+ return this.inBuffer.hasBufferedData();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthInputStream.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthInputStream.java
index bc6ce4c..501c2b2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthInputStream.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthInputStream.java
@@ -215,12 +215,12 @@ public class ContentLengthInputStream extends InputStream {
// skip and keep track of the bytes actually skipped
long count = 0;
while (remaining > 0) {
- final int l = read(buffer, 0, (int)Math.min(BUFFER_SIZE, remaining));
- if (l == -1) {
+ final int readLen = read(buffer, 0, (int)Math.min(BUFFER_SIZE, remaining));
+ if (readLen == -1) {
break;
}
- count += l;
- remaining -= l;
+ count += readLen;
+ remaining -= readLen;
}
return count;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthOutputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthOutputStream.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthOutputStream.java
index 1f4d398..aedb0ba 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthOutputStream.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ContentLengthOutputStream.java
@@ -59,10 +59,10 @@ public class ContentLengthOutputStream extends OutputStream {
private final long contentLength;
/** Total bytes written */
- private long total = 0;
+ private long total;
/** True if the stream is closed. */
- private boolean closed = false;
+ private boolean closed;
/**
* Default constructor.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java
index 9036caa..4f770d0 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java
@@ -149,8 +149,8 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
if (len == ContentLengthStrategy.UNDEFINED) {
throw new LengthRequiredException("Length required");
}
- try (final OutputStream outstream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), entity.getTrailers())) {
- entity.writeTo(outstream);
+ try (final OutputStream outStream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), entity.getTrailers())) {
+ entity.writeTo(outStream);
}
}
@@ -169,11 +169,11 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
}
final long len = this.outgoingContentStrategy.determineLength(request);
if (len == ContentLengthStrategy.CHUNKED) {
- final OutputStream outstream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), entity.getTrailers());
- outstream.close();
+ final OutputStream outStream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), entity.getTrailers());
+ outStream.close();
} else if (len >= 0 && len <= 1024) {
- try (final OutputStream outstream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), null)) {
- entity.writeTo(outstream);
+ try (final OutputStream outStream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), null)) {
+ entity.writeTo(outStream);
}
} else {
this.consistent = false;
@@ -183,7 +183,7 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
@Override
public ClassicHttpResponse receiveResponseHeader() throws HttpException, IOException {
final SocketHolder socketHolder = ensureOpen();
- final ClassicHttpResponse response = this.responseParser.parse(this.inbuffer, socketHolder.getInputStream());
+ final ClassicHttpResponse response = this.responseParser.parse(this.inBuffer, socketHolder.getInputStream());
final ProtocolVersion transportVersion = response.getVersion();
if (transportVersion != null && transportVersion.greaterEquals(HttpVersion.HTTP_2)) {
throw new UnsupportedHttpVersionException("Unsupported version: " + transportVersion);
@@ -208,6 +208,6 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
if (len == ContentLengthStrategy.UNDEFINED) {
return;
}
- response.setEntity(createIncomingEntity(response, this.inbuffer, socketHolder.getInputStream(), len));
+ response.setEntity(createIncomingEntity(response, this.inBuffer, socketHolder.getInputStream(), len));
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
index f06ec63..c9d87c3 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
@@ -132,7 +132,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
@Override
public ClassicHttpRequest receiveRequestHeader() throws HttpException, IOException {
final SocketHolder socketHolder = ensureOpen();
- final ClassicHttpRequest request = this.requestParser.parse(this.inbuffer, socketHolder.getInputStream());
+ final ClassicHttpRequest request = this.requestParser.parse(this.inBuffer, socketHolder.getInputStream());
final ProtocolVersion transportVersion = request.getVersion();
if (transportVersion != null && transportVersion.greaterEquals(HttpVersion.HTTP_2)) {
throw new UnsupportedHttpVersionException("Unsupported version: " + transportVersion);
@@ -154,7 +154,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
if (len == ContentLengthStrategy.UNDEFINED) {
return;
}
- final HttpEntity entity = createIncomingEntity(request, this.inbuffer, socketHolder.getInputStream(), len);
+ final HttpEntity entity = createIncomingEntity(request, this.inBuffer, socketHolder.getInputStream(), len);
request.setEntity(entity);
}
@@ -180,8 +180,8 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
return;
}
final long len = this.outgoingContentStrategy.determineLength(response);
- try (final OutputStream outstream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), entity.getTrailers())) {
- entity.writeTo(outstream);
+ try (final OutputStream outStream = createContentOutputStream(len, this.outbuffer, socketHolder.getOutputStream(), entity.getTrailers())) {
+ entity.writeTo(outStream);
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionInputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionInputBufferImpl.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionInputBufferImpl.java
index f9db0de..245a1b2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionInputBufferImpl.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionInputBufferImpl.java
@@ -71,7 +71,7 @@ public class SessionInputBufferImpl implements SessionInputBuffer {
* Creates new instance of SessionInputBufferImpl.
*
* @param metrics HTTP transport metrics.
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param minChunkLimit size limit below which data chunks should be buffered in memory
* in order to minimize native method invocations on the underlying network socket.
* The optimal value of this parameter can be platform specific and defines a trade-off
@@ -83,26 +83,26 @@ public class SessionInputBufferImpl implements SessionInputBuffer {
*/
public SessionInputBufferImpl(
final BasicHttpTransportMetrics metrics,
- final int buffersize,
+ final int bufferSize,
final int minChunkLimit,
final int maxLineLen,
final CharsetDecoder chardecoder) {
Args.notNull(metrics, "HTTP transport metrcis");
- Args.positive(buffersize, "Buffer size");
+ Args.positive(bufferSize, "Buffer size");
this.metrics = metrics;
- this.buffer = new byte[buffersize];
+ this.buffer = new byte[bufferSize];
this.bufferPos = 0;
this.bufferLen = 0;
this.minChunkLimit = minChunkLimit >= 0 ? minChunkLimit : 512;
this.maxLineLen = maxLineLen > 0 ? maxLineLen : 0;
- this.lineBuffer = new ByteArrayBuffer(buffersize);
+ this.lineBuffer = new ByteArrayBuffer(bufferSize);
this.decoder = chardecoder;
}
public SessionInputBufferImpl(
final BasicHttpTransportMetrics metrics,
- final int buffersize) {
- this(metrics, buffersize, buffersize, 0, null);
+ final int bufferSize) {
+ this(metrics, bufferSize, bufferSize, 0, null);
}
public SessionInputBufferImpl(final int bufferSize, final int maxLineLen) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionOutputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionOutputBufferImpl.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionOutputBufferImpl.java
index 6a99672..cb30398 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionOutputBufferImpl.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/SessionOutputBufferImpl.java
@@ -67,7 +67,7 @@ public class SessionOutputBufferImpl implements SessionOutputBuffer {
* Creates new instance of SessionOutputBufferImpl.
*
* @param metrics HTTP transport metrics.
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragementSizeHint fragment size hint defining a minimal size of a fragment
* that should be written out directly to the socket bypassing the session buffer.
* Value {@code 0} disables fragment buffering.
@@ -76,24 +76,24 @@ public class SessionOutputBufferImpl implements SessionOutputBuffer {
*/
public SessionOutputBufferImpl(
final BasicHttpTransportMetrics metrics,
- final int buffersize,
+ final int bufferSize,
final int fragementSizeHint,
final CharsetEncoder charencoder) {
super();
- Args.positive(buffersize, "Buffer size");
+ Args.positive(bufferSize, "Buffer size");
Args.notNull(metrics, "HTTP transport metrcis");
this.metrics = metrics;
- this.buffer = new ByteArrayBuffer(buffersize);
- this.fragementSizeHint = fragementSizeHint >= 0 ? fragementSizeHint : buffersize;
+ this.buffer = new ByteArrayBuffer(bufferSize);
+ this.fragementSizeHint = fragementSizeHint >= 0 ? fragementSizeHint : bufferSize;
this.encoder = charencoder;
}
- public SessionOutputBufferImpl(final int buffersize) {
- this(new BasicHttpTransportMetrics(), buffersize, buffersize, null);
+ public SessionOutputBufferImpl(final int bufferSize) {
+ this(new BasicHttpTransportMetrics(), bufferSize, bufferSize, null);
}
- public SessionOutputBufferImpl(final int buffersize, final CharsetEncoder encoder) {
- this(new BasicHttpTransportMetrics(), buffersize, buffersize, encoder);
+ public SessionOutputBufferImpl(final int bufferSize, final CharsetEncoder encoder) {
+ this(new BasicHttpTransportMetrics(), bufferSize, bufferSize, encoder);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
index 56ec938..1d75d43 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
@@ -49,11 +49,11 @@ public class ExpandableBuffer {
/**
* Allocates buffer of the given size using the given allocator.
*
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
*/
- protected ExpandableBuffer(final int buffersize) {
+ protected ExpandableBuffer(final int bufferSize) {
super();
- this.buffer = ByteBuffer.allocate(buffersize);
+ this.buffer = ByteBuffer.allocate(bufferSize);
this.mode = INPUT_MODE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionInputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionInputBufferImpl.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionInputBufferImpl.java
index 59d0774..f5e4e5a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionInputBufferImpl.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionInputBufferImpl.java
@@ -59,7 +59,7 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
/**
* Creates SessionInputBufferImpl instance.
*
- * @param buffersize input buffer size
+ * @param bufferSize input buffer size
* @param lineBuffersize buffer size for line operations. Has effect only if
* {@code chardecoder} is not {@code null}.
* @param chardecoder chardecoder to be used for decoding HTTP protocol elements.
@@ -69,11 +69,11 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
* @since 4.4
*/
public SessionInputBufferImpl(
- final int buffersize,
+ final int bufferSize,
final int lineBuffersize,
final int maxLineLen,
final CharsetDecoder chardecoder) {
- super(buffersize);
+ super(bufferSize);
this.lineBuffersize = Args.positive(lineBuffersize, "Line buffer size");
this.maxLineLen = maxLineLen > 0 ? maxLineLen : 0;
this.chardecoder = chardecoder;
@@ -83,37 +83,37 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
* @since 4.3
*/
public SessionInputBufferImpl(
- final int buffersize,
+ final int bufferSize,
final int lineBuffersize,
final int maxLineLen,
final Charset charset) {
- this(buffersize, lineBuffersize, maxLineLen, charset != null ? charset.newDecoder() : null);
+ this(bufferSize, lineBuffersize, maxLineLen, charset != null ? charset.newDecoder() : null);
}
/**
* @since 4.3
*/
public SessionInputBufferImpl(
- final int buffersize,
+ final int bufferSize,
final int lineBuffersize,
final int maxLineLen) {
- this(buffersize, lineBuffersize, maxLineLen, (CharsetDecoder) null);
+ this(bufferSize, lineBuffersize, maxLineLen, (CharsetDecoder) null);
}
/**
* @since 4.3
*/
public SessionInputBufferImpl(
- final int buffersize,
+ final int bufferSize,
final int lineBuffersize) {
- this(buffersize, lineBuffersize, 0, (CharsetDecoder) null);
+ this(bufferSize, lineBuffersize, 0, (CharsetDecoder) null);
}
/**
* @since 4.3
*/
- public SessionInputBufferImpl(final int buffersize) {
- this(buffersize, 256);
+ public SessionInputBufferImpl(final int bufferSize) {
+ this(bufferSize, 256);
}
public void put(final ByteBuffer src) {
@@ -198,7 +198,7 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
@Override
public boolean readLine(
- final CharArrayBuffer linebuffer,
+ final CharArrayBuffer lineBuffer,
final boolean endOfStream) throws IOException {
setOutputMode();
@@ -234,18 +234,18 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
final int requiredCapacity = buffer().limit() - buffer().position();
// Ensure capacity of len assuming ASCII as the most likely charset
- linebuffer.ensureCapacity(requiredCapacity);
+ lineBuffer.ensureCapacity(requiredCapacity);
if (this.chardecoder == null) {
if (buffer().hasArray()) {
final byte[] b = buffer().array();
final int off = buffer().position();
final int len = buffer().remaining();
- linebuffer.append(b, off, len);
+ lineBuffer.append(b, off, len);
buffer().position(off + len);
} else {
while (buffer().hasRemaining()) {
- linebuffer.append((char) (buffer().get() & 0xff));
+ lineBuffer.append((char) (buffer().get() & 0xff));
}
}
} else {
@@ -264,7 +264,7 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
}
if (result.isOverflow()) {
this.charbuffer.flip();
- linebuffer.append(
+ lineBuffer.append(
this.charbuffer.array(),
this.charbuffer.position(),
this.charbuffer.remaining());
@@ -280,7 +280,7 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
this.charbuffer.flip();
// append the decoded content to the line buffer
if (this.charbuffer.hasRemaining()) {
- linebuffer.append(
+ lineBuffer.append(
this.charbuffer.array(),
this.charbuffer.position(),
this.charbuffer.remaining());
@@ -290,16 +290,16 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
buffer().limit(origLimit);
// discard LF if found
- int l = linebuffer.length();
+ int l = lineBuffer.length();
if (l > 0) {
- if (linebuffer.charAt(l - 1) == Chars.LF) {
+ if (lineBuffer.charAt(l - 1) == Chars.LF) {
l--;
- linebuffer.setLength(l);
+ lineBuffer.setLength(l);
}
// discard CR if found
- if (l > 0 && linebuffer.charAt(l - 1) == Chars.CR) {
+ if (l > 0 && lineBuffer.charAt(l - 1) == Chars.CR) {
l--;
- linebuffer.setLength(l);
+ lineBuffer.setLength(l);
}
}
return true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionOutputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionOutputBufferImpl.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionOutputBufferImpl.java
index 8d75d95..f631910 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionOutputBufferImpl.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionOutputBufferImpl.java
@@ -60,7 +60,7 @@ public class SessionOutputBufferImpl extends ExpandableBuffer implements Session
/**
* Creates SessionOutputBufferImpl instance.
*
- * @param buffersize input buffer size
+ * @param bufferSize input buffer size
* @param lineBuffersize buffer size for line operations. Has effect only if
* {@code charencoder} is not {@code null}.
* @param charencoder charencoder to be used for encoding HTTP protocol elements.
@@ -69,10 +69,10 @@ public class SessionOutputBufferImpl extends ExpandableBuffer implements Session
* @since 4.3
*/
public SessionOutputBufferImpl(
- final int buffersize,
+ final int bufferSize,
final int lineBuffersize,
final CharsetEncoder charencoder) {
- super(buffersize);
+ super(bufferSize);
this.lineBuffersize = Args.positive(lineBuffersize, "Line buffer size");
this.charencoder = charencoder;
}
@@ -81,26 +81,26 @@ public class SessionOutputBufferImpl extends ExpandableBuffer implements Session
* @since 4.3
*/
public SessionOutputBufferImpl(
- final int buffersize,
- final int linebuffersize,
+ final int bufferSize,
+ final int lineBufferSize,
final Charset charset) {
- this(buffersize, linebuffersize, charset != null ? charset.newEncoder() : null);
+ this(bufferSize, lineBufferSize, charset != null ? charset.newEncoder() : null);
}
/**
* @since 4.3
*/
public SessionOutputBufferImpl(
- final int buffersize,
- final int linebuffersize) {
- this(buffersize, linebuffersize, (CharsetEncoder) null);
+ final int bufferSize,
+ final int lineBufferSize) {
+ this(bufferSize, lineBufferSize, (CharsetEncoder) null);
}
/**
* @since 4.3
*/
- public SessionOutputBufferImpl(final int buffersize) {
- this(buffersize, 256);
+ public SessionOutputBufferImpl(final int bufferSize) {
+ this(bufferSize, 256);
}
@Override
@@ -147,27 +147,27 @@ public class SessionOutputBufferImpl extends ExpandableBuffer implements Session
}
@Override
- public void writeLine(final CharArrayBuffer linebuffer) throws CharacterCodingException {
- if (linebuffer == null) {
+ public void writeLine(final CharArrayBuffer lineBuffer) throws CharacterCodingException {
+ if (lineBuffer == null) {
return;
}
setInputMode();
// Do not bother if the buffer is empty
- if (linebuffer.length() > 0 ) {
+ if (lineBuffer.length() > 0 ) {
if (this.charencoder == null) {
- final int requiredCapacity = buffer().position() + linebuffer.length();
+ final int requiredCapacity = buffer().position() + lineBuffer.length();
ensureCapacity(requiredCapacity);
if (buffer().hasArray()) {
final byte[] b = buffer().array();
- final int len = linebuffer.length();
+ final int len = lineBuffer.length();
final int off = buffer().position();
for (int i = 0; i < len; i++) {
- b[off + i] = (byte) linebuffer.charAt(i);
+ b[off + i] = (byte) lineBuffer.charAt(i);
}
buffer().position(off + len);
} else {
- for (int i = 0; i < linebuffer.length(); i++) {
- buffer().put((byte) linebuffer.charAt(i));
+ for (int i = 0; i < lineBuffer.length(); i++) {
+ buffer().put((byte) lineBuffer.charAt(i));
}
}
} else {
@@ -176,7 +176,7 @@ public class SessionOutputBufferImpl extends ExpandableBuffer implements Session
}
this.charencoder.reset();
// transfer the string in small chunks
- int remaining = linebuffer.length();
+ int remaining = lineBuffer.length();
int offset = 0;
while (remaining > 0) {
int l = this.charbuffer.remaining();
@@ -186,7 +186,7 @@ public class SessionOutputBufferImpl extends ExpandableBuffer implements Session
// terminate the encoding process
eol = true;
}
- this.charbuffer.put(linebuffer.array(), offset, l);
+ this.charbuffer.put(lineBuffer.array(), offset, l);
this.charbuffer.flip();
boolean retry = true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/EofSensorInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/EofSensorInputStream.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/EofSensorInputStream.java
index 53025c8..a8af3a4 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/EofSensorInputStream.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/EofSensorInputStream.java
@@ -111,36 +111,36 @@ public class EofSensorInputStream extends InputStream {
@Override
public int read() throws IOException {
- int l = -1;
+ int b = -1;
if (isReadAllowed()) {
try {
- l = wrappedStream.read();
- checkEOF(l);
+ b = wrappedStream.read();
+ checkEOF(b);
} catch (final IOException ex) {
checkAbort();
throw ex;
}
}
- return l;
+ return b;
}
@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-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/AbstractImmutableHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/AbstractImmutableHttpEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/AbstractImmutableHttpEntity.java
index fb5ab7b..1ec31ee 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/AbstractImmutableHttpEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/AbstractImmutableHttpEntity.java
@@ -44,18 +44,18 @@ public abstract class AbstractImmutableHttpEntity implements HttpEntity, HttpCon
static final int OUTPUT_BUFFER_SIZE = 4096;
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = getContent();
- if (instream != null) {
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = getContent();
+ if (inStream != null) {
try {
int l;
final byte[] tmp = new byte[OUTPUT_BUFFER_SIZE];
- 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-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
index f557451..ad0d491 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
@@ -97,11 +97,11 @@ public class BasicHttpEntity extends AbstractHttpEntity {
/**
* Specifies the content.
*
- * @param instream the stream to return with the next call to
+ * @param inStream the stream to return with the next call to
* {@link #getContent getContent}
*/
- public void setContent(final InputStream instream) {
- this.content = instream;
+ public void setContent(final InputStream inStream) {
+ this.content = inStream;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BufferedHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BufferedHttpEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BufferedHttpEntity.java
index df459ad..05a7efd 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BufferedHttpEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BufferedHttpEntity.java
@@ -105,12 +105,12 @@ public class BufferedHttpEntity extends HttpEntityWrapper {
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
if (this.buffer != null) {
- outstream.write(this.buffer);
+ outStream.write(this.buffer);
} else {
- super.writeTo(outstream);
+ super.writeTo(outStream);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
index f74b952..cd7c78f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
@@ -101,10 +101,10 @@ public class ByteArrayEntity extends AbstractHttpEntity {
}
@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();
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
index 4f9db29..33853db 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
@@ -99,11 +99,11 @@ public class ByteBufferEntity extends AbstractHttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final WritableByteChannel channel = Channels.newChannel(outstream);
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final WritableByteChannel channel = Channels.newChannel(outStream);
channel.write(buffer);
- outstream.flush();
+ outStream.flush();
}
@Override