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:54 UTC
[1/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
Repository: httpcomponents-core
Updated Branches:
refs/heads/master 7e07b8f78 -> 346037342
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
index 3bac6d1..ee0908f 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
@@ -53,8 +53,8 @@ public class TestMessageParser {
" \r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
- final Header[] headers = AbstractMessageParser.parseHeaders(inbuffer, inputStream, -1, -1, null);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final Header[] headers = AbstractMessageParser.parseHeaders(inBuffer, inputStream, -1, -1, null);
Assert.assertNotNull(headers);
Assert.assertEquals(3, headers.length);
Assert.assertEquals("header1", headers[0].getName());
@@ -70,8 +70,8 @@ public class TestMessageParser {
final String s = "header1: stuff; param1 = value1; param2 = \"value 2\" \r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
- final Header[] headers = AbstractMessageParser.parseHeaders(inbuffer, inputStream, -1, -1, null);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final Header[] headers = AbstractMessageParser.parseHeaders(inBuffer, inputStream, -1, -1, null);
Assert.assertNotNull(headers);
Assert.assertEquals(1, headers.length);
Assert.assertEquals("header1: stuff; param1 = value1; param2 = \"value 2\" ", headers[0].toString());
@@ -83,9 +83,9 @@ public class TestMessageParser {
"header1: stuff\r\n" +
"\r\n";
final ByteArrayInputStream inputStream1 = new ByteArrayInputStream(s1.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
try {
- AbstractMessageParser.parseHeaders(inbuffer1, inputStream1, -1, -1, null);
+ AbstractMessageParser.parseHeaders(inBuffer1, inputStream1, -1, -1, null);
Assert.fail("ProtocolException should have been thrown");
} catch (final ProtocolException ex) {
// expected
@@ -94,9 +94,9 @@ public class TestMessageParser {
"header1: stuff\r\n" +
"\r\n";
final ByteArrayInputStream inputStream2 = new ByteArrayInputStream(s2.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer2 = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
try {
- AbstractMessageParser.parseHeaders(inbuffer2, inputStream2, -1, -1, null);
+ AbstractMessageParser.parseHeaders(inBuffer2, inputStream2, -1, -1, null);
Assert.fail("ProtocolException should have been thrown");
} catch (final ProtocolException ex) {
// expected
@@ -109,8 +109,8 @@ public class TestMessageParser {
" header1: stuff\r\n" +
"header2: stuff \r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
- final Header[] headers = AbstractMessageParser.parseHeaders(inbuffer, inputStream, -1, -1, null);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final Header[] headers = AbstractMessageParser.parseHeaders(inBuffer, inputStream, -1, -1, null);
Assert.assertNotNull(headers);
Assert.assertEquals(2, headers.length);
Assert.assertEquals("header1", headers[0].getName());
@@ -123,8 +123,8 @@ public class TestMessageParser {
public void testEmptyDataStream() throws Exception {
final String s = "";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
- final Header[] headers = AbstractMessageParser.parseHeaders(inbuffer, inputStream, -1, -1, null);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final Header[] headers = AbstractMessageParser.parseHeaders(inBuffer, inputStream, -1, -1, null);
Assert.assertNotNull(headers);
Assert.assertEquals(0, headers.length);
}
@@ -137,9 +137,9 @@ public class TestMessageParser {
"header3: stuff\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
try {
- AbstractMessageParser.parseHeaders(inbuffer, inputStream, 2, -1, null);
+ AbstractMessageParser.parseHeaders(inBuffer, inputStream, 2, -1, null);
Assert.fail("IOException should have been thrown");
} catch (final IOException ex) {
// expected
@@ -154,9 +154,9 @@ public class TestMessageParser {
" stuff\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
try {
- AbstractMessageParser.parseHeaders(inbuffer, inputStream, 2, 15, null);
+ AbstractMessageParser.parseHeaders(inBuffer, inputStream, 2, 15, null);
Assert.fail("IOException should have been thrown");
} catch (final IOException ex) {
// expected
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java
index e78b3e6..462e293 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java
@@ -53,10 +53,10 @@ public class TestRequestParser {
"Cookie: c1=stuff\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpRequestParser parser = new DefaultHttpRequestParser();
- final ClassicHttpRequest httprequest = parser.parse(inbuffer, inputStream);
+ final ClassicHttpRequest httprequest = parser.parse(inBuffer, inputStream);
Assert.assertEquals("GET", httprequest.getMethod());
Assert.assertEquals("/", httprequest.getPath());
@@ -67,10 +67,10 @@ public class TestRequestParser {
@Test(expected = ConnectionClosedException.class)
public void testConnectionClosedException() throws Exception {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] {});
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final DefaultHttpRequestParser parser = new DefaultHttpRequestParser();
- parser.parse(inbuffer, inputStream);
+ parser.parse(inBuffer, inputStream);
}
@Test
@@ -82,11 +82,11 @@ public class TestRequestParser {
"Host: localhost\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpRequestParser parser = new DefaultHttpRequestParser(
H1Config.custom().setMaxEmptyLineCount(3).build());
- final ClassicHttpRequest httprequest = parser.parse(inbuffer, inputStream);
+ final ClassicHttpRequest httprequest = parser.parse(inBuffer, inputStream);
Assert.assertEquals("GET", httprequest.getMethod());
Assert.assertEquals("/", httprequest.getPath());
@@ -104,11 +104,11 @@ public class TestRequestParser {
"Host: localhost\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpRequestParser parser = new DefaultHttpRequestParser(
H1Config.custom().setMaxEmptyLineCount(3).build());
- parser.parse(inbuffer, inputStream);
+ parser.parse(inBuffer, inputStream);
}
@Test
@@ -120,7 +120,7 @@ public class TestRequestParser {
"Coo\000kie: c1=stuff\r\n" +
"\000\r\n";
final TimeoutByteArrayInputStream inputStream = new TimeoutByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final DefaultHttpRequestParser parser = new DefaultHttpRequestParser();
@@ -129,7 +129,7 @@ public class TestRequestParser {
ClassicHttpRequest httprequest = null;
for (int i = 0; i < 10; i++) {
try {
- httprequest = parser.parse(inbuffer, inputStream);
+ httprequest = parser.parse(inBuffer, inputStream);
break;
} catch (final InterruptedIOException ex) {
timeoutCount++;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java
index 09bae3b..480ee87 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestResponseParser.java
@@ -54,10 +54,10 @@ public class TestResponseParser {
"Set-Cookie: c1=stuff\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpResponseParser parser = new DefaultHttpResponseParser();
- final ClassicHttpResponse httpresponse = parser.parse(inbuffer, inputStream);
+ final ClassicHttpResponse httpresponse = parser.parse(inBuffer, inputStream);
Assert.assertEquals(200, httpresponse.getCode());
Assert.assertEquals("OK", httpresponse.getReasonPhrase());
@@ -68,10 +68,10 @@ public class TestResponseParser {
@Test(expected = NoHttpResponseException.class)
public void testConnectionClosedException() throws Exception {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] {});
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final DefaultHttpResponseParser parser = new DefaultHttpResponseParser();
- parser.parse(inbuffer, inputStream);
+ parser.parse(inBuffer, inputStream);
}
@Test
@@ -83,11 +83,11 @@ public class TestResponseParser {
"Server: whatever\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpResponseParser parser = new DefaultHttpResponseParser(
H1Config.custom().setMaxEmptyLineCount(3).build());
- final ClassicHttpResponse httpresponse = parser.parse(inbuffer, inputStream);
+ final ClassicHttpResponse httpresponse = parser.parse(inBuffer, inputStream);
Assert.assertEquals(200, httpresponse.getCode());
Assert.assertEquals("OK", httpresponse.getReasonPhrase());
@@ -105,11 +105,11 @@ public class TestResponseParser {
"Server: whatever\r\n" +
"\r\n";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.US_ASCII.newDecoder());
final DefaultHttpResponseParser parser = new DefaultHttpResponseParser(
H1Config.custom().setMaxEmptyLineCount(3).build());
- parser.parse(inbuffer, inputStream);
+ parser.parse(inBuffer, inputStream);
}
@Test
@@ -121,7 +121,7 @@ public class TestResponseParser {
"Set-Coo\000kie: c1=stuff\r\n" +
"\000\r\n";
final TimeoutByteArrayInputStream inputStream = new TimeoutByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final DefaultHttpResponseParser parser = new DefaultHttpResponseParser();
@@ -130,7 +130,7 @@ public class TestResponseParser {
ClassicHttpResponse httpresponse = null;
for (int i = 0; i < 10; i++) {
try {
- httpresponse = parser.parse(inbuffer, inputStream);
+ httpresponse = parser.parse(inBuffer, inputStream);
break;
} catch (final InterruptedIOException ex) {
timeoutCount++;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java
index 64f8891..5b48379 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java
@@ -51,14 +51,14 @@ public class TestSessionInOutBuffers {
@Test
public void testBasicBufferProperties() throws Exception {
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] { 1, 2 , 3});
- Assert.assertEquals(16, inbuffer.capacity());
- Assert.assertEquals(16, inbuffer.available());
- Assert.assertEquals(0, inbuffer.length());
- inbuffer.read(inputStream);
- Assert.assertEquals(14, inbuffer.available());
- Assert.assertEquals(2, inbuffer.length());
+ Assert.assertEquals(16, inBuffer.capacity());
+ Assert.assertEquals(16, inBuffer.available());
+ Assert.assertEquals(0, inBuffer.length());
+ inBuffer.read(inputStream);
+ Assert.assertEquals(14, inBuffer.available());
+ Assert.assertEquals(2, inBuffer.length());
final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -106,20 +106,20 @@ public class TestSessionInOutBuffers {
}
Assert.assertEquals(expected, bytesWritten);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
for (final String teststr : teststrs) {
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(teststr, chbuffer.toString());
}
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
- tmetrics = inbuffer.getMetrics();
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
+ tmetrics = inBuffer.getMetrics();
final long bytesRead = tmetrics.getBytesTransferred();
Assert.assertEquals(expected, bytesRead);
}
@@ -179,41 +179,41 @@ public class TestSessionInOutBuffers {
bytesWritten = outbuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(8 + 14 + 2 + 15 + 2 + 16 + 2 + 1, bytesWritten);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals("a", chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals("", chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals("\r", chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals("", chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(s1, chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(s2, chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(s3, chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals("a", chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
+ inBuffer.readLine(chbuffer, inputStream);
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
- final long bytesRead = inbuffer.getMetrics().getBytesTransferred();
+ inBuffer.readLine(chbuffer, inputStream);
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
+ final long bytesRead = inBuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(bytesWritten, bytesRead);
}
@@ -252,19 +252,19 @@ public class TestSessionInOutBuffers {
}
Assert.assertEquals(expected, bytesWritten);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(1024);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(1024);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
for (final String teststr : teststrs) {
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(teststr, chbuffer.toString());
}
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
- final long bytesRead = inbuffer.getMetrics().getBytesTransferred();
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
+ final long bytesRead = inBuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(expected, bytesRead);
}
@@ -298,13 +298,13 @@ public class TestSessionInOutBuffers {
Assert.assertEquals(out[i], tmp[i]);
}
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(tmp);
// these read operations will have no effect
- Assert.assertEquals(0, inbuffer.read(null, 0, 10, inputStream));
- Assert.assertEquals(0, inbuffer.read(null, inputStream));
- long bytesRead = inbuffer.getMetrics().getBytesTransferred();
+ Assert.assertEquals(0, inBuffer.read(null, 0, 10, inputStream));
+ Assert.assertEquals(0, inBuffer.read(null, inputStream));
+ long bytesRead = inBuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(0, bytesRead);
final byte[] in = new byte[40];
@@ -315,19 +315,19 @@ public class TestSessionInOutBuffers {
if (chunk > remaining) {
chunk = remaining;
}
- final int l = inbuffer.read(in, off, chunk, inputStream);
- if (l == -1) {
+ final int readLen = inBuffer.read(in, off, chunk, inputStream);
+ if (readLen == -1) {
break;
}
- off += l;
- remaining -= l;
+ off += readLen;
+ remaining -= readLen;
}
for (int i = 0; i < out.length; i++) {
Assert.assertEquals(out[i], in[i]);
}
- Assert.assertEquals(-1, inbuffer.read(tmp, inputStream));
- Assert.assertEquals(-1, inbuffer.read(tmp, inputStream));
- bytesRead = inbuffer.getMetrics().getBytesTransferred();
+ Assert.assertEquals(-1, inBuffer.read(tmp, inputStream));
+ Assert.assertEquals(-1, inBuffer.read(tmp, inputStream));
+ bytesRead = inBuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(out.length, bytesRead);
}
@@ -353,18 +353,18 @@ public class TestSessionInOutBuffers {
Assert.assertEquals(out[i], tmp[i]);
}
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(tmp);
final byte[] in = new byte[40];
for (int i = 0; i < in.length; i++) {
- in[i] = (byte)inbuffer.read(inputStream);
+ in[i] = (byte)inBuffer.read(inputStream);
}
for (int i = 0; i < out.length; i++) {
Assert.assertEquals(out[i], in[i]);
}
- Assert.assertEquals(-1, inbuffer.read(inputStream));
- Assert.assertEquals(-1, inbuffer.read(inputStream));
- final long bytesRead = inbuffer.getMetrics().getBytesTransferred();
+ Assert.assertEquals(-1, inBuffer.read(inputStream));
+ Assert.assertEquals(-1, inBuffer.read(inputStream));
+ final long bytesRead = inBuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(out.length, bytesRead);
}
@@ -398,19 +398,19 @@ public class TestSessionInOutBuffers {
final String s = "a very looooooooooooooooooooooooooooooooooooooooooong line\r\n";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
// no limit
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(5);
+ final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(5);
final InputStream inputStream1 = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
- inbuffer1.readLine(chbuffer, inputStream1);
- final long bytesRead = inbuffer1.getMetrics().getBytesTransferred();
+ inBuffer1.readLine(chbuffer, inputStream1);
+ final long bytesRead = inBuffer1.getMetrics().getBytesTransferred();
Assert.assertEquals(60, bytesRead);
// 15 char limit
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(5, 15);
+ final SessionInputBuffer inBuffer2 = new SessionInputBufferImpl(5, 15);
final InputStream inputStream2 = new ByteArrayInputStream(tmp);
try {
chbuffer.clear();
- inbuffer2.readLine(chbuffer, inputStream2);
+ inBuffer2.readLine(chbuffer, inputStream2);
Assert.fail("MessageConstraintException expected");
} catch (final MessageConstraintException ex) {
}
@@ -421,19 +421,19 @@ public class TestSessionInOutBuffers {
final String s = "just a line\r\n";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
// no limit
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(25);
+ final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(25);
final InputStream inputStream1 = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
- inbuffer1.readLine(chbuffer, inputStream1);
- final long bytesRead = inbuffer1.getMetrics().getBytesTransferred();
+ inBuffer1.readLine(chbuffer, inputStream1);
+ final long bytesRead = inBuffer1.getMetrics().getBytesTransferred();
Assert.assertEquals(13, bytesRead);
// 10 char limit
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(25, 10);
+ final SessionInputBuffer inBuffer2 = new SessionInputBufferImpl(25, 10);
final InputStream inputStream2 = new ByteArrayInputStream(tmp);
try {
chbuffer.clear();
- inbuffer2.readLine(chbuffer, inputStream2);
+ inBuffer2.readLine(chbuffer, inputStream2);
Assert.fail("MessageConstraintException expected");
} catch (final MessageConstraintException ex) {
}
@@ -443,10 +443,10 @@ public class TestSessionInOutBuffers {
public void testLineLimit3() throws Exception {
final String s = "012345678\r\nblaaaaaaaaaaaaaaaaaah";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(128);
+ final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(128);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
- inbuffer1.readLine(chbuffer, inputStream);
+ inBuffer1.readLine(chbuffer, inputStream);
Assert.assertEquals("012345678", chbuffer.toString());
}
@@ -454,14 +454,14 @@ public class TestSessionInOutBuffers {
public void testReadLineFringeCase1() throws Exception {
final String s = "abc\r\n";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(128);
+ final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(128);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(tmp);
- Assert.assertEquals('a', inbuffer1.read(inputStream));
- Assert.assertEquals('b', inbuffer1.read(inputStream));
- Assert.assertEquals('c', inbuffer1.read(inputStream));
- Assert.assertEquals('\r', inbuffer1.read(inputStream));
+ Assert.assertEquals('a', inBuffer1.read(inputStream));
+ Assert.assertEquals('b', inBuffer1.read(inputStream));
+ Assert.assertEquals('c', inBuffer1.read(inputStream));
+ Assert.assertEquals('\r', inBuffer1.read(inputStream));
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
- Assert.assertEquals(0, inbuffer1.readLine(chbuffer, inputStream));
+ Assert.assertEquals(0, inBuffer1.readLine(chbuffer, inputStream));
}
static final int SWISS_GERMAN_HELLO [] = {
@@ -511,25 +511,25 @@ public class TestSessionInOutBuffers {
(s3.getBytes(StandardCharsets.UTF_8).length + 2)) * 10;
Assert.assertEquals(expected, bytesWritten);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.UTF_8.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.UTF_8.newDecoder());
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
for (int i = 0; i < 10; i++) {
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(s1, chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(s2, chbuffer.toString());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(s3, chbuffer.toString());
}
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
- final long bytesRead = inbuffer.getMetrics().getBytesTransferred();
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
+ final long bytesRead = inBuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(expected, bytesRead);
}
@@ -552,11 +552,11 @@ public class TestSessionInOutBuffers {
outbuffer.writeLine(chbuffer, outputStream);
outbuffer.flush(outputStream);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.UTF_8.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.UTF_8.newDecoder());
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
chbuffer.clear();
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(s, chbuffer.toString());
}
@@ -580,22 +580,22 @@ public class TestSessionInOutBuffers {
final long expected = ((s1.getBytes(StandardCharsets.ISO_8859_1).length + 2)) * 10 + 2;
Assert.assertEquals(expected, bytesWritten);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, StandardCharsets.ISO_8859_1.newDecoder());
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, StandardCharsets.ISO_8859_1.newDecoder());
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
for (int i = 0; i < 10; i++) {
chbuffer.clear();
- final int len = inbuffer.readLine(chbuffer, inputStream);
+ final int len = inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals(len, SWISS_GERMAN_HELLO.length);
Assert.assertEquals(s1, chbuffer.toString());
}
chbuffer.clear();
- Assert.assertEquals(0, inbuffer.readLine(chbuffer, inputStream));
+ Assert.assertEquals(0, inBuffer.readLine(chbuffer, inputStream));
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
chbuffer.clear();
- Assert.assertEquals(-1, inbuffer.readLine(chbuffer, inputStream));
- final long bytesRead = inbuffer.getMetrics().getBytesTransferred();
+ Assert.assertEquals(-1, inBuffer.readLine(chbuffer, inputStream));
+ final long bytesRead = inBuffer.getMetrics().getBytesTransferred();
Assert.assertEquals(expected, bytesRead);
}
@@ -650,10 +650,10 @@ public class TestSessionInOutBuffers {
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPORT);
decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, decoder);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, decoder);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(32);
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
}
@Test
@@ -662,10 +662,10 @@ public class TestSessionInOutBuffers {
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPLACE);
decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, decoder);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, decoder);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(32);
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals("Gr\ufffdezi_z\ufffdm\ufffd", chbuffer.toString());
}
@@ -675,10 +675,10 @@ public class TestSessionInOutBuffers {
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
decoder.onMalformedInput(CodingErrorAction.IGNORE);
decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16, decoder);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16, decoder);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(32);
- inbuffer.readLine(chbuffer, inputStream);
+ inBuffer.readLine(chbuffer, inputStream);
Assert.assertEquals("Grezi_zm", chbuffer.toString());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java
index 614b02a..175bfda 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java
@@ -52,8 +52,8 @@ import org.junit.Test;
*/
public class TestSessionInOutBuffers {
- private static WritableByteChannel newChannel(final ByteArrayOutputStream outstream) {
- return Channels.newChannel(outstream);
+ private static WritableByteChannel newChannel(final ByteArrayOutputStream outStream) {
+ return Channels.newChannel(outStream);
}
private static ReadableByteChannel newChannel(final byte[] bytes) {
@@ -194,11 +194,11 @@ public class TestSessionInOutBuffers {
line.clear();
Assert.assertFalse(inbuf.readLine(line, true));
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel outChannel = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel outChannel = newChannel(outStream);
outbuf.flush(outChannel);
- final String s = new String(outstream.toByteArray(), "US-ASCII");
+ final String s = new String(outStream.toByteArray(), "US-ASCII");
Assert.assertEquals("One\r\nTwo\r\nThree\r\nFour\r\n", s);
}
@@ -228,11 +228,11 @@ public class TestSessionInOutBuffers {
//this write operation should have no effect
outbuf.writeLine(null);
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel outChannel = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel outChannel = newChannel(outStream);
outbuf.flush(outChannel);
- final ReadableByteChannel channel = newChannel(outstream.toByteArray());
+ final ReadableByteChannel channel = newChannel(outStream.toByteArray());
final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, 0);
inbuf.fill(channel);
@@ -282,11 +282,11 @@ public class TestSessionInOutBuffers {
outbuf.write(ByteBuffer.wrap(new byte[] {'a'}));
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel outChannel = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel outChannel = newChannel(outStream);
outbuf.flush(outChannel);
- final ReadableByteChannel channel = newChannel(outstream.toByteArray());
+ final ReadableByteChannel channel = newChannel(outStream.toByteArray());
final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, 0);
inbuf.fill(channel);
@@ -390,11 +390,11 @@ public class TestSessionInOutBuffers {
while (inbuf.fill(channel) > 0) {
}
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel dst = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel dst = newChannel(outStream);
Assert.assertEquals(16, inbuf.read(dst));
- Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
+ Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outStream.toByteArray()));
}
@Test
@@ -405,13 +405,13 @@ public class TestSessionInOutBuffers {
while (inbuf.fill(channel) > 0) {
}
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel dst = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel dst = newChannel(outStream);
Assert.assertEquals(10, inbuf.read(dst, 10));
Assert.assertEquals(3, inbuf.read(dst, 3));
Assert.assertEquals(3, inbuf.read(dst, 10));
- Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
+ Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outStream.toByteArray()));
}
@Test
@@ -422,11 +422,11 @@ public class TestSessionInOutBuffers {
final ReadableByteChannel src = newChannel(pattern);
outbuf.write(src);
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel channel = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel channel = newChannel(outStream);
while (outbuf.flush(channel) > 0) {
}
- Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
+ Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outStream.toByteArray()));
}
@Test
@@ -438,11 +438,11 @@ public class TestSessionInOutBuffers {
outbuf.write(ByteBuffer.wrap(pattern, 16, 10));
outbuf.write(ByteBuffer.wrap(pattern, 26, 6));
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel channel = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel channel = newChannel(outStream);
while (outbuf.flush(channel) > 0) {
}
- Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
+ Assert.assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outStream.toByteArray()));
}
static final int SWISS_GERMAN_HELLO [] = {
@@ -486,11 +486,11 @@ public class TestSessionInOutBuffers {
outbuf.writeLine(chbuffer);
}
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- final WritableByteChannel outChannel = newChannel(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ final WritableByteChannel outChannel = newChannel(outStream);
outbuf.flush(outChannel);
- final byte[] tmp = outstream.toByteArray();
+ final byte[] tmp = outStream.toByteArray();
final ReadableByteChannel channel = newChannel(tmp);
final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, 0,
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/io/TestEofSensorInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/io/TestEofSensorInputStream.java b/httpcore5/src/test/java/org/apache/hc/core5/http/io/TestEofSensorInputStream.java
index cc5eff3..52d5733 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/io/TestEofSensorInputStream.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/io/TestEofSensorInputStream.java
@@ -37,15 +37,15 @@ import org.mockito.Mockito;
@SuppressWarnings({"boxing","static-access"}) // test code
public class TestEofSensorInputStream {
- private InputStream instream;
+ private InputStream inStream;
private EofSensorWatcher eofwatcher;
private EofSensorInputStream eofstream;
@Before
public void setup() throws Exception {
- instream = Mockito.mock(InputStream.class);
+ inStream = Mockito.mock(InputStream.class);
eofwatcher = Mockito.mock(EofSensorWatcher.class);
- eofstream = new EofSensorInputStream(instream, eofwatcher);
+ eofstream = new EofSensorInputStream(inStream, eofwatcher);
}
@Test
@@ -57,8 +57,8 @@ public class TestEofSensorInputStream {
Assert.assertTrue(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(instream, Mockito.times(1)).close();
- Mockito.verify(eofwatcher).streamClosed(instream);
+ Mockito.verify(inStream, Mockito.times(1)).close();
+ Mockito.verify(eofwatcher).streamClosed(inStream);
eofstream.close();
}
@@ -75,7 +75,7 @@ public class TestEofSensorInputStream {
Assert.assertTrue(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(eofwatcher).streamClosed(instream);
+ Mockito.verify(eofwatcher).streamClosed(inStream);
}
@Test
@@ -87,8 +87,8 @@ public class TestEofSensorInputStream {
Assert.assertTrue(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(instream, Mockito.times(1)).close();
- Mockito.verify(eofwatcher).streamClosed(instream);
+ Mockito.verify(inStream, Mockito.times(1)).close();
+ Mockito.verify(eofwatcher).streamClosed(inStream);
eofstream.close();
}
@@ -102,8 +102,8 @@ public class TestEofSensorInputStream {
Assert.assertTrue(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(instream, Mockito.times(1)).close();
- Mockito.verify(eofwatcher).streamAbort(instream);
+ Mockito.verify(inStream, Mockito.times(1)).close();
+ Mockito.verify(eofwatcher).streamAbort(inStream);
eofstream.abort();
}
@@ -120,28 +120,28 @@ public class TestEofSensorInputStream {
Assert.assertTrue(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(eofwatcher).streamAbort(instream);
+ Mockito.verify(eofwatcher).streamAbort(inStream);
}
@Test
public void testRead() throws Exception {
Mockito.when(eofwatcher.eofDetected(Mockito.<InputStream>any())).thenReturn(Boolean.TRUE);
- Mockito.when(instream.read()).thenReturn(0, -1);
+ Mockito.when(inStream.read()).thenReturn(0, -1);
Assert.assertEquals(0, eofstream.read());
Assert.assertFalse(eofstream.isSelfClosed());
Assert.assertNotNull(eofstream.getWrappedStream());
- Mockito.verify(eofwatcher, Mockito.never()).eofDetected(instream);
+ Mockito.verify(eofwatcher, Mockito.never()).eofDetected(inStream);
Assert.assertEquals(-1, eofstream.read());
Assert.assertFalse(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(instream, Mockito.times(1)).close();
- Mockito.verify(eofwatcher).eofDetected(instream);
+ Mockito.verify(inStream, Mockito.times(1)).close();
+ Mockito.verify(eofwatcher).eofDetected(inStream);
Assert.assertEquals(-1, eofstream.read());
}
@@ -149,7 +149,7 @@ public class TestEofSensorInputStream {
@Test
public void testReadIOError() throws Exception {
Mockito.when(eofwatcher.eofDetected(Mockito.<InputStream>any())).thenReturn(Boolean.TRUE);
- Mockito.when(instream.read()).thenThrow(new IOException());
+ Mockito.when(inStream.read()).thenThrow(new IOException());
try {
eofstream.read();
@@ -159,13 +159,13 @@ public class TestEofSensorInputStream {
Assert.assertFalse(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(eofwatcher).streamAbort(instream);
+ Mockito.verify(eofwatcher).streamAbort(inStream);
}
@Test
public void testReadByteArray() throws Exception {
Mockito.when(eofwatcher.eofDetected(Mockito.<InputStream>any())).thenReturn(Boolean.TRUE);
- Mockito.when(instream.read(Mockito.<byte []>any(), Mockito.anyInt(), Mockito.anyInt()))
+ Mockito.when(inStream.read(Mockito.<byte []>any(), Mockito.anyInt(), Mockito.anyInt()))
.thenReturn(1, -1);
final byte[] tmp = new byte[1];
@@ -175,15 +175,15 @@ public class TestEofSensorInputStream {
Assert.assertFalse(eofstream.isSelfClosed());
Assert.assertNotNull(eofstream.getWrappedStream());
- Mockito.verify(eofwatcher, Mockito.never()).eofDetected(instream);
+ Mockito.verify(eofwatcher, Mockito.never()).eofDetected(inStream);
Assert.assertEquals(-1, eofstream.read(tmp));
Assert.assertFalse(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(instream, Mockito.times(1)).close();
- Mockito.verify(eofwatcher).eofDetected(instream);
+ Mockito.verify(inStream, Mockito.times(1)).close();
+ Mockito.verify(eofwatcher).eofDetected(inStream);
Assert.assertEquals(-1, eofstream.read(tmp));
}
@@ -191,7 +191,7 @@ public class TestEofSensorInputStream {
@Test
public void testReadByteArrayIOError() throws Exception {
Mockito.when(eofwatcher.eofDetected(Mockito.<InputStream>any())).thenReturn(Boolean.TRUE);
- Mockito.when(instream.read(Mockito.<byte []>any(), Mockito.anyInt(), Mockito.anyInt()))
+ Mockito.when(inStream.read(Mockito.<byte []>any(), Mockito.anyInt(), Mockito.anyInt()))
.thenThrow(new IOException());
final byte[] tmp = new byte[1];
@@ -203,7 +203,7 @@ public class TestEofSensorInputStream {
Assert.assertFalse(eofstream.isSelfClosed());
Assert.assertNull(eofstream.getWrappedStream());
- Mockito.verify(eofwatcher).streamAbort(instream);
+ Mockito.verify(eofwatcher).streamAbort(inStream);
}
@Test
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java b/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java
index 6d9d7da..d28fb8c 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestFileEntity.java
@@ -74,12 +74,12 @@ public class TestFileEntity {
final File tmpfile = File.createTempFile("testfile", ".txt");
tmpfile.deleteOnExit();
- final FileOutputStream outstream = new FileOutputStream(tmpfile);
- outstream.write(0);
- outstream.write(1);
- outstream.write(2);
- outstream.write(3);
- outstream.close();
+ final FileOutputStream outStream = new FileOutputStream(tmpfile);
+ outStream.write(0);
+ outStream.write(1);
+ outStream.write(2);
+ outStream.write(3);
+ outStream.close();
final FileEntity httpentity = new FileEntity(tmpfile, ContentType.TEXT_PLAIN);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestInputStreamEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestInputStreamEntity.java b/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestInputStreamEntity.java
index 82a0195..f78f870 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestInputStreamEntity.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestInputStreamEntity.java
@@ -44,11 +44,11 @@ public class TestInputStreamEntity {
@Test
public void testBasics() throws Exception {
final byte[] bytes = "Message content".getBytes(StandardCharsets.ISO_8859_1);
- final InputStream instream = new ByteArrayInputStream(bytes);
- final InputStreamEntity httpentity = new InputStreamEntity(instream, bytes.length);
+ final InputStream inStream = new ByteArrayInputStream(bytes);
+ final InputStreamEntity httpentity = new InputStreamEntity(inStream, bytes.length);
Assert.assertEquals(bytes.length, httpentity.getContentLength());
- Assert.assertEquals(instream, httpentity.getContent());
+ Assert.assertEquals(inStream, httpentity.getContent());
Assert.assertNotNull(httpentity.getContent());
Assert.assertFalse(httpentity.isRepeatable());
Assert.assertTrue(httpentity.isStreaming());
@@ -61,8 +61,8 @@ public class TestInputStreamEntity {
@Test
public void testUnknownLengthConstructor() throws Exception {
- final InputStream instream = new ByteArrayInputStream(new byte[0]);
- final InputStreamEntity httpentity = new InputStreamEntity(instream);
+ final InputStream inStream = new ByteArrayInputStream(new byte[0]);
+ final InputStreamEntity httpentity = new InputStreamEntity(inStream);
Assert.assertEquals(-1, httpentity.getContentLength());
}
@@ -70,8 +70,8 @@ public class TestInputStreamEntity {
public void testWriteTo() throws Exception {
final String message = "Message content";
final byte[] bytes = message.getBytes(StandardCharsets.ISO_8859_1);
- final InputStream instream = new ByteArrayInputStream(bytes);
- final InputStreamEntity httpentity = new InputStreamEntity(instream, bytes.length);
+ final InputStream inStream = new ByteArrayInputStream(bytes);
+ final InputStreamEntity httpentity = new InputStreamEntity(inStream, bytes.length);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
httpentity.writeTo(out);
@@ -87,9 +87,9 @@ public class TestInputStreamEntity {
public void testWriteToPartialContent() throws Exception {
final String message = "Message content";
final byte[] bytes = message.getBytes(StandardCharsets.ISO_8859_1);
- final InputStream instream = new ByteArrayInputStream(bytes);
+ final InputStream inStream = new ByteArrayInputStream(bytes);
final int contentLength = 7;
- final InputStreamEntity httpentity = new InputStreamEntity(instream, contentLength);
+ final InputStreamEntity httpentity = new InputStreamEntity(inStream, contentLength);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
httpentity.writeTo(out);
@@ -105,8 +105,8 @@ public class TestInputStreamEntity {
public void testWriteToUnknownLength() throws Exception {
final String message = "Message content";
final byte[] bytes = message.getBytes(StandardCharsets.ISO_8859_1);
- final InputStream instream = new ByteArrayInputStream(bytes);
- final InputStreamEntity httpentity = new InputStreamEntity(instream);
+ final InputStream inStream = new ByteArrayInputStream(bytes);
+ final InputStreamEntity httpentity = new InputStreamEntity(inStream);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
httpentity.writeTo(out);
@@ -120,8 +120,8 @@ public class TestInputStreamEntity {
@Test(expected = IllegalArgumentException.class)
public void testWriteToNull() throws Exception {
- final InputStream instream = new ByteArrayInputStream(new byte[0]);
- final InputStreamEntity httpentity = new InputStreamEntity(instream, 0);
+ final InputStream inStream = new ByteArrayInputStream(new byte[0]);
+ final InputStreamEntity httpentity = new InputStreamEntity(inStream, 0);
httpentity.writeTo(null);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
index 7bf10d3..ffb4bed 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
@@ -60,13 +60,13 @@ public class TestBufferedHeader {
buf.append("name: value");
final BufferedHeader orig = new BufferedHeader(buf, false);
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 BufferedHeader clone = (BufferedHeader) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final BufferedHeader clone = (BufferedHeader) inStream.readObject();
Assert.assertEquals(orig.getName(), clone.getName());
Assert.assertEquals(orig.getValue(), clone.getValue());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
index cf46f55..fb1146a 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
@@ -77,13 +77,13 @@ public class TestHeader {
public void testSerialization() throws Exception {
final BasicHeader orig = new BasicHeader("name1", "value1");
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 BasicHeader clone = (BasicHeader) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final BasicHeader clone = (BasicHeader) inStream.readObject();
Assert.assertEquals(orig.getName(), clone.getName());
Assert.assertEquals(orig.getValue(), clone.getValue());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeaderGroup.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeaderGroup.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeaderGroup.java
index ffa96b3..4d8ee21 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeaderGroup.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeaderGroup.java
@@ -199,13 +199,13 @@ public class TestHeaderGroup {
final Header header3 = new BasicHeader("name", "value3");
orig.setHeaders(new Header[] { header1, header2, header3 });
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 HeaderGroup clone = (HeaderGroup) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final HeaderGroup clone = (HeaderGroup) inStream.readObject();
final Header[] headers1 = orig.getAllHeaders();
final Header[] headers2 = clone.getAllHeaders();
Assert.assertNotNull(headers1);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java b/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
index 131e63c..4fdbe7a 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
@@ -98,13 +98,13 @@ public class TestHost {
public void testSerialization() throws Exception {
final Host orig = new Host("somehost", 8080);
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 Host clone = (Host) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final Host clone = (Host) inStream.readObject();
Assert.assertEquals(orig, clone);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java b/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java
index 8bb1b94..570e1d6 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java
@@ -107,13 +107,13 @@ public class TestURIAuthority {
public void testSerialization() throws Exception {
final URIAuthority orig = new URIAuthority("somehost", 8080);
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 URIAuthority clone = (URIAuthority) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final URIAuthority clone = (URIAuthority) inStream.readObject();
Assert.assertEquals(orig, clone);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/util/TestByteArrayBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestByteArrayBuffer.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestByteArrayBuffer.java
index 65a688a..d311638 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestByteArrayBuffer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestByteArrayBuffer.java
@@ -295,13 +295,13 @@ public class TestByteArrayBuffer {
orig.append(2);
orig.append(3);
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
- try (final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer)) {
- outstream.writeObject(orig);
+ try (final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer)) {
+ outStream.writeObject(orig);
}
final byte[] raw = outbuffer.toByteArray();
- final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
- final ObjectInputStream instream = new ObjectInputStream(inbuffer);
- final ByteArrayBuffer clone = (ByteArrayBuffer) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final ByteArrayBuffer clone = (ByteArrayBuffer) inStream.readObject();
Assert.assertEquals(orig.capacity(), clone.capacity());
Assert.assertEquals(orig.length(), clone.length());
final byte[] data = clone.toByteArray();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java
index d8aaedc..1fe85ee 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java
@@ -382,13 +382,13 @@ public class TestCharArrayBuffer {
orig.append('b');
orig.append('c');
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
- try (final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer)) {
- outstream.writeObject(orig);
+ try (final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer)) {
+ outStream.writeObject(orig);
}
final byte[] raw = outbuffer.toByteArray();
- final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
- final ObjectInputStream instream = new ObjectInputStream(inbuffer);
- final CharArrayBuffer clone = (CharArrayBuffer) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final CharArrayBuffer clone = (CharArrayBuffer) inStream.readObject();
Assert.assertEquals(orig.capacity(), clone.capacity());
Assert.assertEquals(orig.length(), clone.length());
final char[] data = clone.toCharArray();
[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
Posted by gg...@apache.org.
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
[2/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
Posted by gg...@apache.org.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/EntityUtils.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/EntityUtils.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/EntityUtils.java
index feae3d7..1873af8 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/EntityUtils.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/EntityUtils.java
@@ -88,9 +88,9 @@ public final class EntityUtils {
return;
}
if (entity.isStreaming()) {
- final InputStream instream = entity.getContent();
- if (instream != null) {
- instream.close();
+ final InputStream inStream = entity.getContent();
+ if (inStream != null) {
+ inStream.close();
}
}
}
@@ -196,8 +196,8 @@ public final class EntityUtils {
*/
public static byte[] toByteArray(final HttpEntity entity) throws IOException {
Args.notNull(entity, "Entity");
- final InputStream instream = entity.getContent();
- if (instream == null) {
+ final InputStream inStream = entity.getContent();
+ if (inStream == null) {
return null;
}
try {
@@ -208,20 +208,20 @@ public final class EntityUtils {
final ByteArrayBuffer buffer = new ByteArrayBuffer(i);
final byte[] tmp = new byte[4096];
int l;
- while((l = instream.read(tmp)) != -1) {
+ while((l = inStream.read(tmp)) != -1) {
buffer.append(tmp, 0, l);
}
return buffer.toByteArray();
} finally {
- instream.close();
+ inStream.close();
}
}
private static String toString(
final HttpEntity entity,
final ContentType contentType) throws IOException {
- final InputStream instream = entity.getContent();
- if (instream == null) {
+ final InputStream inStream = entity.getContent();
+ if (inStream == null) {
return null;
}
try {
@@ -240,7 +240,7 @@ public final class EntityUtils {
if (charset == null) {
charset = StandardCharsets.ISO_8859_1;
}
- final Reader reader = new InputStreamReader(instream, charset);
+ final Reader reader = new InputStreamReader(inStream, charset);
final CharArrayBuffer buffer = new CharArrayBuffer(contentLength);
final char[] tmp = new char[1024];
int chReadCount;
@@ -249,7 +249,7 @@ public final class EntityUtils {
}
return buffer.toString();
} finally {
- instream.close();
+ inStream.close();
}
}
@@ -349,14 +349,14 @@ public final class EntityUtils {
final long len = entity.getContentLength();
Args.checkRange(len, 0, Integer.MAX_VALUE, "HTTP entity is too large");
final Charset charset = contentType.getCharset() != null ? contentType.getCharset() : StandardCharsets.ISO_8859_1;
- final InputStream instream = entity.getContent();
- if (instream == null) {
+ final InputStream inStream = entity.getContent();
+ if (inStream == null) {
return Collections.emptyList();
}
final CharArrayBuffer buf;
try {
buf = new CharArrayBuffer(len > 0 ? (int) len : 1024);
- final Reader reader = new InputStreamReader(instream, charset);
+ final Reader reader = new InputStreamReader(inStream, charset);
final char[] tmp = new char[1024];
int l;
while((l = reader.read(tmp)) != -1) {
@@ -364,7 +364,7 @@ public final class EntityUtils {
}
} finally {
- instream.close();
+ inStream.close();
}
if (buf.isEmpty()) {
return Collections.emptyList();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpContentProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpContentProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpContentProducer.java
index 27db0c3..742426b 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpContentProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpContentProducer.java
@@ -39,6 +39,6 @@ import java.io.OutputStream;
*/
public interface HttpContentProducer {
- void writeTo(OutputStream outstream) throws IOException;
+ void writeTo(OutputStream outStream) throws IOException;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
index bd7599a..a676cfc 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
@@ -91,9 +91,9 @@ public class HttpEntityWithTrailers implements HttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream)
+ public void writeTo(final OutputStream outStream)
throws IOException {
- wrappedEntity.writeTo(outstream);
+ wrappedEntity.writeTo(outStream);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
index 135fad0..f162859 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
@@ -92,9 +92,9 @@ public class HttpEntityWrapper implements HttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream)
+ public void writeTo(final OutputStream outStream)
throws IOException {
- wrappedEntity.writeTo(outstream);
+ wrappedEntity.writeTo(outStream);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
index 74027f4..9f2e68e 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
@@ -47,50 +47,50 @@ public class InputStreamEntity extends AbstractHttpEntity {
/**
* Creates an entity with an unknown length.
- * Equivalent to {@code new InputStreamEntity(instream, -1)}.
+ * Equivalent to {@code new InputStreamEntity(inStream, -1)}.
*
- * @param instream input stream
- * @throws IllegalArgumentException if {@code instream} is {@code null}
+ * @param inStream input stream
+ * @throws IllegalArgumentException if {@code inStream} is {@code null}
* @since 4.3
*/
- public InputStreamEntity(final InputStream instream) {
- this(instream, -1);
+ public InputStreamEntity(final InputStream inStream) {
+ this(inStream, -1);
}
/**
* Creates an entity with a specified content length.
*
- * @param instream input stream
+ * @param inStream input stream
* @param length of the input stream, {@code -1} if unknown
- * @throws IllegalArgumentException if {@code instream} is {@code null}
+ * @throws IllegalArgumentException if {@code inStream} is {@code null}
*/
- public InputStreamEntity(final InputStream instream, final long length) {
- this(instream, length, null);
+ public InputStreamEntity(final InputStream inStream, final long length) {
+ this(inStream, length, null);
}
/**
* Creates an entity with a content type and unknown length.
- * Equivalent to {@code new InputStreamEntity(instream, -1, contentType)}.
+ * Equivalent to {@code new InputStreamEntity(inStream, -1, contentType)}.
*
- * @param instream input stream
+ * @param inStream input stream
* @param contentType content type
- * @throws IllegalArgumentException if {@code instream} is {@code null}
+ * @throws IllegalArgumentException if {@code inStream} is {@code null}
* @since 4.3
*/
- public InputStreamEntity(final InputStream instream, final ContentType contentType) {
- this(instream, -1, contentType);
+ public InputStreamEntity(final InputStream inStream, final ContentType contentType) {
+ this(inStream, -1, contentType);
}
/**
- * @param instream input stream
+ * @param inStream input stream
* @param length of the input stream, {@code -1} if unknown
* @param contentType for specifying the {@code Content-Type} header, may be {@code null}
- * @throws IllegalArgumentException if {@code instream} is {@code null}
+ * @throws IllegalArgumentException if {@code inStream} is {@code null}
* @since 4.2
*/
- public InputStreamEntity(final InputStream instream, final long length, final ContentType contentType) {
+ public InputStreamEntity(final InputStream inStream, final long length, final ContentType contentType) {
super();
- this.content = Args.notNull(instream, "Source input stream");
+ this.content = Args.notNull(inStream, "Source input stream");
this.length = length;
if (contentType != null) {
setContentType(contentType.toString());
@@ -123,31 +123,31 @@ public class InputStreamEntity extends AbstractHttpEntity {
*
*/
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = this.content;
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = this.content;
try {
final byte[] buffer = new byte[OUTPUT_BUFFER_SIZE];
- int l;
+ int readLen;
if (this.length < 0) {
// consume until EOF
- while ((l = instream.read(buffer)) != -1) {
- outstream.write(buffer, 0, l);
+ while ((readLen = inStream.read(buffer)) != -1) {
+ outStream.write(buffer, 0, readLen);
}
} else {
// consume no more than length
long remaining = this.length;
while (remaining > 0) {
- l = instream.read(buffer, 0, (int)Math.min(OUTPUT_BUFFER_SIZE, remaining));
- if (l == -1) {
+ readLen = inStream.read(buffer, 0, (int)Math.min(OUTPUT_BUFFER_SIZE, remaining));
+ if (readLen == -1) {
break;
}
- outstream.write(buffer, 0, l);
- remaining -= l;
+ outStream.write(buffer, 0, readLen);
+ remaining -= readLen;
}
}
} finally {
- instream.close();
+ inStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
index b54237e..c1b5163 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
@@ -113,15 +113,15 @@ public class SerializableEntity extends AbstractHttpEntity {
}
@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.objSer == null) {
- final ObjectOutputStream out = new ObjectOutputStream(outstream);
+ final ObjectOutputStream out = new ObjectOutputStream(outStream);
out.writeObject(this.objRef);
out.flush();
} else {
- outstream.write(this.objSer);
- outstream.flush();
+ outStream.write(this.objSer);
+ 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/StringEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java
index 6f2879a..4608dbb 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java
@@ -115,10 +115,10 @@ public class StringEntity extends AbstractHttpEntity implements Cloneable {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- outstream.write(this.content);
- outstream.flush();
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ outStream.write(this.content);
+ outStream.flush();
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedInputBuffer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedInputBuffer.java
index 7303f70..24abeda 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedInputBuffer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedInputBuffer.java
@@ -47,8 +47,8 @@ public final class SharedInputBuffer extends AbstractSharedBuffer implements Con
super(lock, initialBufferSize);
}
- public SharedInputBuffer(final int buffersize) {
- super(new ReentrantLock(), buffersize);
+ public SharedInputBuffer(final int bufferSize) {
+ super(new ReentrantLock(), bufferSize);
}
public int fill(final ByteBuffer src) throws IOException {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedOutputBuffer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedOutputBuffer.java
index f5da5f7..701ad87 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedOutputBuffer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/SharedOutputBuffer.java
@@ -49,8 +49,8 @@ public final class SharedOutputBuffer extends AbstractSharedBuffer implements Co
this.hasCapacity = false;
}
- public SharedOutputBuffer(final int buffersize) {
- this(new ReentrantLock(), buffersize);
+ public SharedOutputBuffer(final int bufferSize) {
+ this(new ReentrantLock(), bufferSize);
}
public void flush(final DataStreamChannel channel) throws IOException {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
index c29a7c3..89ecac2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/ssl/SSLContextBuilder.java
@@ -228,8 +228,8 @@ public class SSLContextBuilder {
final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException {
Args.notNull(file, "Truststore file");
final KeyStore trustStore = KeyStore.getInstance(keyStoreType);
- try (final FileInputStream instream = new FileInputStream(file)) {
- trustStore.load(instream, storePassword);
+ try (final FileInputStream inStream = new FileInputStream(file)) {
+ trustStore.load(inStream, storePassword);
}
return loadTrustMaterial(trustStore, trustStrategy);
}
@@ -251,8 +251,8 @@ public class SSLContextBuilder {
final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException {
Args.notNull(url, "Truststore URL");
final KeyStore trustStore = KeyStore.getInstance(keyStoreType);
- try (final InputStream instream = url.openStream()) {
- trustStore.load(instream, storePassword);
+ try (final InputStream inStream = url.openStream()) {
+ trustStore.load(inStream, storePassword);
}
return loadTrustMaterial(trustStore, trustStrategy);
}
@@ -302,8 +302,8 @@ public class SSLContextBuilder {
final PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException {
Args.notNull(file, "Keystore file");
final KeyStore identityStore = KeyStore.getInstance(keyStoreType);
- try (final FileInputStream instream = new FileInputStream(file)) {
- identityStore.load(instream, storePassword);
+ try (final FileInputStream inStream = new FileInputStream(file)) {
+ identityStore.load(inStream, storePassword);
}
return loadKeyMaterial(identityStore, keyPassword, aliasStrategy);
}
@@ -322,8 +322,8 @@ public class SSLContextBuilder {
final PrivateKeyStrategy aliasStrategy) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, CertificateException, IOException {
Args.notNull(url, "Keystore URL");
final KeyStore identityStore = KeyStore.getInstance(keyStoreType);
- try (final InputStream instream = url.openStream()) {
- identityStore.load(instream, storePassword);
+ try (final InputStream inStream = url.openStream()) {
+ identityStore.load(inStream, storePassword);
}
return loadKeyMaterial(identityStore, keyPassword, aliasStrategy);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java
index 2cb0e6b..970da95 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java
@@ -185,13 +185,13 @@ public class TestHttpHost {
public void testSerialization() throws Exception {
final HttpHost orig = new HttpHost("somehost", 8080, "https");
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 HttpHost clone = (HttpHost) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final HttpHost clone = (HttpHost) inStream.readObject();
Assert.assertEquals(orig, clone);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java
index c957dc8..85cc485 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java
@@ -108,13 +108,13 @@ public class TestHttpVersion {
public void testSerialization() throws Exception {
final HttpVersion orig = HttpVersion.HTTP_1_1;
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 HttpVersion clone = (HttpVersion) instream.readObject();
+ final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw);
+ final ObjectInputStream inStream = new ObjectInputStream(inBuffer);
+ final HttpVersion clone = (HttpVersion) inStream.readObject();
Assert.assertEquals(orig, clone);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
index e667001..3fecc9d 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
@@ -97,15 +97,15 @@ public class TestBHttpConnectionBase {
@Test
public void testConnectionClose() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
- final OutputStream outstream = Mockito.mock(OutputStream.class);
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ final OutputStream outStream = Mockito.mock(OutputStream.class);
- Mockito.when(socket.getInputStream()).thenReturn(instream);
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
conn.ensureOpen();
- conn.outbuffer.write(0, outstream);
+ conn.outbuffer.write(0, outStream);
Assert.assertTrue(conn.isOpen());
@@ -113,7 +113,7 @@ public class TestBHttpConnectionBase {
Assert.assertFalse(conn.isOpen());
- Mockito.verify(outstream, Mockito.times(1)).write(
+ Mockito.verify(outStream, Mockito.times(1)).write(
ArgumentMatchers.<byte[]>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
Mockito.verify(socket, Mockito.times(1)).shutdownInput();
Mockito.verify(socket, Mockito.times(1)).shutdownOutput();
@@ -121,20 +121,20 @@ public class TestBHttpConnectionBase {
conn.close();
Mockito.verify(socket, Mockito.times(1)).close();
- Mockito.verify(outstream, Mockito.times(1)).write(
+ Mockito.verify(outStream, Mockito.times(1)).write(
ArgumentMatchers.<byte[]>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
}
@Test
public void testConnectionShutdown() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
- final OutputStream outstream = Mockito.mock(OutputStream.class);
- Mockito.when(socket.getInputStream()).thenReturn(instream);
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ final OutputStream outStream = Mockito.mock(OutputStream.class);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
conn.ensureOpen();
- conn.outbuffer.write(0, outstream);
+ conn.outbuffer.write(0, outStream);
Assert.assertTrue(conn.isOpen());
@@ -142,7 +142,7 @@ public class TestBHttpConnectionBase {
Assert.assertFalse(conn.isOpen());
- Mockito.verify(outstream, Mockito.never()).write(
+ Mockito.verify(outStream, Mockito.never()).write(
ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
Mockito.verify(socket, Mockito.never()).shutdownInput();
Mockito.verify(socket, Mockito.never()).shutdownOutput();
@@ -157,12 +157,12 @@ public class TestBHttpConnectionBase {
@Test
public void testCreateEntityLengthDelimited() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
+ final InputStream inStream = Mockito.mock(InputStream.class);
final ClassicHttpResponse message = new BasicClassicHttpResponse(200, "OK");
message.addHeader("Content-Length", "10");
message.addHeader("Content-Type", "stuff");
message.addHeader("Content-Encoding", "chunked");
- final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer, instream, 10);
+ final HttpEntity entity = conn.createIncomingEntity(message, conn.inBuffer, inStream, 10);
Assert.assertNotNull(entity);
Assert.assertFalse(entity.isChunked());
Assert.assertEquals(10, entity.getContentLength());
@@ -175,9 +175,9 @@ public class TestBHttpConnectionBase {
@Test
public void testCreateEntityInputChunked() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
+ final InputStream inStream = Mockito.mock(InputStream.class);
final ClassicHttpResponse message = new BasicClassicHttpResponse(200, "OK");
- final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer, instream, ContentLengthStrategy.CHUNKED);
+ final HttpEntity entity = conn.createIncomingEntity(message, conn.inBuffer, inStream, ContentLengthStrategy.CHUNKED);
Assert.assertNotNull(entity);
Assert.assertTrue(entity.isChunked());
Assert.assertEquals(-1, entity.getContentLength());
@@ -188,9 +188,9 @@ public class TestBHttpConnectionBase {
@Test
public void testCreateEntityInputUndefined() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
+ final InputStream inStream = Mockito.mock(InputStream.class);
final ClassicHttpResponse message = new BasicClassicHttpResponse(200, "OK");
- final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer, instream, ContentLengthStrategy.UNDEFINED);
+ final HttpEntity entity = conn.createIncomingEntity(message, conn.inBuffer, inStream, ContentLengthStrategy.UNDEFINED);
Assert.assertNotNull(entity);
Assert.assertFalse(entity.isChunked());
Assert.assertEquals(-1, entity.getContentLength());
@@ -241,26 +241,26 @@ public class TestBHttpConnectionBase {
@Test
public void testAwaitInputInBuffer() throws Exception {
- final ByteArrayInputStream instream = Mockito.spy(new ByteArrayInputStream(
+ final ByteArrayInputStream inStream = Mockito.spy(new ByteArrayInputStream(
new byte[] {1, 2, 3, 4, 5}));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
conn.ensureOpen();
- conn.inbuffer.read(instream);
+ conn.inBuffer.read(inStream);
Assert.assertTrue(conn.awaitInput(432));
Mockito.verify(socket, Mockito.never()).setSoTimeout(ArgumentMatchers.anyInt());
- Mockito.verify(instream, Mockito.times(1)).read(
+ Mockito.verify(inStream, Mockito.times(1)).read(
ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
}
@Test
public void testAwaitInputInSocket() throws Exception {
- final ByteArrayInputStream instream = Mockito.spy(new ByteArrayInputStream(
+ final ByteArrayInputStream inStream = Mockito.spy(new ByteArrayInputStream(
new byte[] {1, 2, 3, 4, 5}));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
Mockito.when(socket.getSoTimeout()).thenReturn(345);
conn.bind(socket);
@@ -270,15 +270,15 @@ public class TestBHttpConnectionBase {
Mockito.verify(socket, Mockito.times(1)).setSoTimeout(432);
Mockito.verify(socket, Mockito.times(1)).setSoTimeout(345);
- Mockito.verify(instream, Mockito.times(1)).read(
+ Mockito.verify(inStream, Mockito.times(1)).read(
ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt());
}
@Test
public void testAwaitInputNoData() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
- Mockito.when(socket.getInputStream()).thenReturn(instream);
- Mockito.when(instream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenReturn(-1);
conn.bind(socket);
@@ -289,9 +289,9 @@ public class TestBHttpConnectionBase {
@Test
public void testStaleWhenClosed() throws Exception {
- final OutputStream outstream = Mockito.mock(OutputStream.class);
+ final OutputStream outStream = Mockito.mock(OutputStream.class);
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
conn.ensureOpen();
@@ -301,9 +301,9 @@ public class TestBHttpConnectionBase {
@Test
public void testNotStaleWhenHasData() throws Exception {
- final ByteArrayInputStream instream = Mockito.spy(new ByteArrayInputStream(
+ final ByteArrayInputStream inStream = Mockito.spy(new ByteArrayInputStream(
new byte[] {1, 2, 3, 4, 5}));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
conn.ensureOpen();
@@ -313,9 +313,9 @@ public class TestBHttpConnectionBase {
@Test
public void testStaleWhenEndOfStream() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
- Mockito.when(socket.getInputStream()).thenReturn(instream);
- Mockito.when(instream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenReturn(-1);
conn.bind(socket);
@@ -326,9 +326,9 @@ public class TestBHttpConnectionBase {
@Test
public void testNotStaleWhenTimeout() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
- Mockito.when(socket.getInputStream()).thenReturn(instream);
- Mockito.when(instream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenThrow(new SocketTimeoutException());
conn.bind(socket);
@@ -339,9 +339,9 @@ public class TestBHttpConnectionBase {
@Test
public void testStaleWhenIOError() throws Exception {
- final InputStream instream = Mockito.mock(InputStream.class);
- Mockito.when(socket.getInputStream()).thenReturn(instream);
- Mockito.when(instream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
+ Mockito.when(inStream.read(ArgumentMatchers.<byte []>any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
.thenThrow(new SocketException());
conn.bind(socket);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java
index 04e007f..e3aab55 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java
@@ -58,9 +58,9 @@ public class TestChunkCoding {
@Test
public void testChunkedInputStreamLargeBuffer() throws IOException {
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(CHUNKED_INPUT.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] buffer = new byte[300];
final ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
@@ -87,9 +87,9 @@ public class TestChunkCoding {
//Test for when buffer is smaller than chunk size.
@Test
public void testChunkedInputStreamSmallBuffer() throws IOException {
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(CHUNKED_INPUT.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] buffer = new byte[7];
final ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -115,9 +115,9 @@ public class TestChunkCoding {
@Test
public void testChunkedInputStreamOneByteRead() throws IOException {
final String s = "5\r\n01234\r\n5\r\n56789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
int ch;
int i = '0';
while ((ch = in.read()) != -1) {
@@ -133,9 +133,9 @@ public class TestChunkCoding {
@Test
public void testAvailable() throws IOException {
final String s = "5\r\n12345\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
Assert.assertEquals(0, in.available());
in.read();
Assert.assertEquals(4, in.available());
@@ -145,9 +145,9 @@ public class TestChunkCoding {
@Test
public void testChunkedInputStreamClose() throws IOException {
final String s = "5\r\n01234\r\n5\r\n56789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
in.close();
in.close();
try {
@@ -172,9 +172,9 @@ public class TestChunkCoding {
@Test(expected=ConnectionClosedException.class)
public void testChunkedInputStreamNoClosingChunk() throws IOException {
final String s = "5\r\n01234\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] tmp = new byte[5];
Assert.assertEquals(5, in.read(tmp));
in.read();
@@ -185,9 +185,9 @@ public class TestChunkCoding {
@Test(expected=MalformedChunkCodingException.class)
public void testCorruptChunkedInputStreamTruncatedCRLF() throws IOException {
final String s = "5\r\n01234";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] tmp = new byte[5];
Assert.assertEquals(5, in.read(tmp));
in.read();
@@ -198,9 +198,9 @@ public class TestChunkCoding {
@Test(expected=MalformedChunkCodingException.class)
public void testCorruptChunkedInputStreamMissingCRLF() throws IOException {
final String s = "5\r\n012345\r\n56789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] buffer = new byte[300];
final ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
@@ -214,9 +214,9 @@ public class TestChunkCoding {
@Test(expected=MalformedChunkCodingException.class)
public void testCorruptChunkedInputStreamMissingLF() throws IOException {
final String s = "5\r01234\r\n5\r\n56789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
in.read();
in.close();
}
@@ -225,9 +225,9 @@ public class TestChunkCoding {
@Test(expected = MalformedChunkCodingException.class)
public void testCorruptChunkedInputStreamInvalidSize() throws IOException {
final String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
in.read();
in.close();
}
@@ -236,9 +236,9 @@ public class TestChunkCoding {
@Test(expected = MalformedChunkCodingException.class)
public void testCorruptChunkedInputStreamNegativeSize() throws IOException {
final String s = "-5\r\n01234\r\n5\r\n56789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
in.read();
in.close();
}
@@ -247,9 +247,9 @@ public class TestChunkCoding {
@Test(expected = TruncatedChunkException.class)
public void testCorruptChunkedInputStreamTruncatedChunk() throws IOException {
final String s = "3\r\n12";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] buffer = new byte[300];
Assert.assertEquals(2, in.read(buffer));
in.read(buffer);
@@ -260,9 +260,9 @@ public class TestChunkCoding {
@Test(expected = MalformedChunkCodingException.class)
public void testCorruptChunkedInputStreamInvalidFooter() throws IOException {
final String s = "1\r\n0\r\n0\r\nstuff\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
in.read();
in.read();
in.close();
@@ -271,9 +271,9 @@ public class TestChunkCoding {
@Test
public void testCorruptChunkedInputStreamClose() throws IOException {
final String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
try {
in.read();
Assert.fail("MalformedChunkCodingException expected");
@@ -285,9 +285,9 @@ public class TestChunkCoding {
@Test
public void testEmptyChunkedInputStream() throws IOException {
final String s = "0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] buffer = new byte[300];
final ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
@@ -301,16 +301,16 @@ public class TestChunkCoding {
@Test
public void testTooLongChunkHeader() throws IOException {
final String s = "5; and some very looooong commend\r\n12345\r\n0\r\n";
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream1 = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in1 = new ChunkedInputStream(inbuffer1, inputStream1);
+ final ChunkedInputStream in1 = new ChunkedInputStream(inBuffer1, inputStream1);
final byte[] buffer = new byte[300];
Assert.assertEquals(5, in1.read(buffer));
in1.close();
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(16, 10);
+ final SessionInputBuffer inBuffer2 = new SessionInputBufferImpl(16, 10);
final ByteArrayInputStream inputStream2 = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in2 = new ChunkedInputStream(inbuffer2, inputStream2);
+ final ChunkedInputStream in2 = new ChunkedInputStream(inBuffer2, inputStream2);
try {
in2.read(buffer);
Assert.fail("MessageConstraintException expected");
@@ -354,9 +354,9 @@ public class TestChunkCoding {
out.flush();
out.close();
out.close();
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] d = new byte[10];
final ByteArrayOutputStream result = new ByteArrayOutputStream();
@@ -436,9 +436,9 @@ public class TestChunkCoding {
@Test
public void testResumeOnSocketTimeoutInData() throws IOException {
final String s = "5\r\n01234\r\n5\r\n5\0006789\r\na\r\n0123\000456789\r\n0\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final TimeoutByteArrayInputStream inputStream = new TimeoutByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] tmp = new byte[3];
@@ -464,9 +464,9 @@ public class TestChunkCoding {
@Test
public void testResumeOnSocketTimeoutInChunk() throws IOException {
final String s = "5\000\r\000\n\00001234\r\n\0005\r\n56789\r\na\r\n0123456789\r\n\0000\r\n";
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final TimeoutByteArrayInputStream inputStream = new TimeoutByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final byte[] tmp = new byte[3];
@@ -493,10 +493,10 @@ public class TestChunkCoding {
@Test
public void testHugeChunk() throws IOException {
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream = new ByteArrayInputStream("1234567890abcdef\r\n01234567".getBytes(
StandardCharsets.ISO_8859_1));
- final ChunkedInputStream in = new ChunkedInputStream(inbuffer, inputStream);
+ final ChunkedInputStream in = new ChunkedInputStream(inBuffer, inputStream);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
for (int i = 0; i < 8; ++i) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java
index f54155e..199baf4 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java
@@ -45,8 +45,8 @@ public class TestContentLengthInputStream {
public void testBasics() throws IOException {
final String s = "1234567890123456";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
- final InputStream in = new ContentLengthInputStream(inbuffer, inputStream, 10L);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
+ final InputStream in = new ContentLengthInputStream(inBuffer, inputStream, 10L);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final byte[] buffer = new byte[50];
@@ -63,23 +63,23 @@ public class TestContentLengthInputStream {
@Test
public void testSkip() throws IOException {
final ByteArrayInputStream inputStream1 = new ByteArrayInputStream(new byte[20]);
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(16);
- final InputStream in1 = new ContentLengthInputStream(inbuffer1, inputStream1, 10L);
+ final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(16);
+ final InputStream in1 = new ContentLengthInputStream(inBuffer1, inputStream1, 10L);
Assert.assertEquals(10, in1.skip(10));
Assert.assertTrue(in1.read() == -1);
in1.close();
final ByteArrayInputStream inputStream2 = new ByteArrayInputStream(new byte[20]);
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(16);
- final InputStream in2 = new ContentLengthInputStream(inbuffer2, inputStream2, 10L);
+ final SessionInputBuffer inBuffer2 = new SessionInputBufferImpl(16);
+ final InputStream in2 = new ContentLengthInputStream(inBuffer2, inputStream2, 10L);
in2.read();
Assert.assertEquals(9, in2.skip(10));
Assert.assertTrue(in2.read() == -1);
in2.close();
final ByteArrayInputStream inputStream3 = new ByteArrayInputStream(new byte[20]);
- final SessionInputBuffer inbuffer3 = new SessionInputBufferImpl(16);
- final InputStream in3 = new ContentLengthInputStream(inbuffer3, inputStream3, 2L);
+ final SessionInputBuffer inBuffer3 = new SessionInputBufferImpl(16);
+ final InputStream in3 = new ContentLengthInputStream(inBuffer3, inputStream3, 2L);
in3.read();
in3.read();
Assert.assertTrue(in3.skip(10) <= 0);
@@ -88,8 +88,8 @@ public class TestContentLengthInputStream {
in3.close();
final ByteArrayInputStream inputStream4 = new ByteArrayInputStream(new byte[20]);
- final SessionInputBuffer inbuffer4 = new SessionInputBufferImpl(16);
- final InputStream in4 = new ContentLengthInputStream(inbuffer4, inputStream4, 10L);
+ final SessionInputBuffer inBuffer4 = new SessionInputBufferImpl(16);
+ final InputStream in4 = new ContentLengthInputStream(inBuffer4, inputStream4, 10L);
Assert.assertEquals(5,in4.skip(5));
Assert.assertEquals(5, in4.read(new byte[20]));
in4.close();
@@ -98,8 +98,8 @@ public class TestContentLengthInputStream {
@Test
public void testAvailable() throws IOException {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] {1, 2, 3});
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
- final InputStream in = new ContentLengthInputStream(inbuffer, inputStream, 3L);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
+ final InputStream in = new ContentLengthInputStream(inBuffer, inputStream, 3L);
Assert.assertEquals(0, in.available());
in.read();
Assert.assertEquals(2, in.available());
@@ -110,8 +110,8 @@ public class TestContentLengthInputStream {
public void testClose() throws IOException {
final String s = "1234567890123456-";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
- final InputStream in = new ContentLengthInputStream(inbuffer, inputStream, 16L);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
+ final InputStream in = new ContentLengthInputStream(inBuffer, inputStream, 16L);
in.close();
in.close();
@@ -131,15 +131,15 @@ public class TestContentLengthInputStream {
Assert.fail("StreamClosedException expected");
} catch (final StreamClosedException expected) {
}
- Assert.assertEquals('-', inbuffer.read(inputStream));
+ Assert.assertEquals('-', inBuffer.read(inputStream));
}
@Test
public void testTruncatedContent() throws IOException {
final String s = "1234567890123456";
final ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
- final InputStream in = new ContentLengthInputStream(inbuffer, inputStream, 32L);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
+ final InputStream in = new ContentLengthInputStream(inBuffer, inputStream, 32L);
final byte[] tmp = new byte[32];
final int byteRead = in.read(tmp);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
index 277ea19..f584353 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
@@ -77,8 +77,8 @@ public class TestDefaultBHttpClientConnection {
@Test
public void testReadResponseHead() throws Exception {
final String s = "HTTP/1.1 200 OK\r\nUser-Agent: test\r\n\r\n";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -94,8 +94,8 @@ public class TestDefaultBHttpClientConnection {
@Test
public void testReadResponseEntityWithContentLength() throws Exception {
final String s = "HTTP/1.1 200 OK\r\nServer: test\r\nContent-Length: 3\r\n\r\n123";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -123,8 +123,8 @@ public class TestDefaultBHttpClientConnection {
public void testReadResponseEntityChunkCoded() throws Exception {
final String s = "HTTP/1.1 200 OK\r\nServer: test\r\nTransfer-Encoding: " +
"chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -152,8 +152,8 @@ public class TestDefaultBHttpClientConnection {
@Test(expected = NotImplementedException.class)
public void testReadResponseEntityIdentity() throws Exception {
final String s = "HTTP/1.1 200 OK\r\nServer: test\r\nTransfer-Encoding: identity\r\n\r\n123";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -172,8 +172,8 @@ public class TestDefaultBHttpClientConnection {
@Test
public void testReadResponseNoEntity() throws Exception {
final String s = "HTTP/1.1 200 OK\r\nServer: test\r\n\r\n";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -194,8 +194,8 @@ public class TestDefaultBHttpClientConnection {
@Test
public void testWriteRequestHead() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -208,14 +208,14 @@ public class TestDefaultBHttpClientConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("GET /stuff HTTP/1.1\r\nUser-Agent: test\r\n\r\n", s);
}
@Test
public void testWriteRequestEntityWithContentLength() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -231,14 +231,14 @@ public class TestDefaultBHttpClientConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nContent-Length: 3\r\n\r\n123", s);
}
@Test
public void testWriteRequestEntityChunkCoded() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -254,15 +254,15 @@ public class TestDefaultBHttpClientConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nTransfer-Encoding: " +
"chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n", s);
}
@Test(expected = LengthRequiredException.class)
public void testWriteRequestEntityNoContentLength() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -278,8 +278,8 @@ public class TestDefaultBHttpClientConnection {
@Test
public void testWriteRequestNoEntity() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -293,14 +293,14 @@ public class TestDefaultBHttpClientConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\n\r\n", s);
}
@Test
public void testTerminateRequestChunkedEntity() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -318,7 +318,7 @@ public class TestDefaultBHttpClientConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nTransfer-Encoding: " +
"chunked\r\n\r\n0\r\n\r\n", s);
Assert.assertTrue(conn.isConsistent());
@@ -326,8 +326,8 @@ public class TestDefaultBHttpClientConnection {
@Test
public void testTerminateRequestContentLengthShort() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -345,7 +345,7 @@ public class TestDefaultBHttpClientConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nContent-Length: " +
"3\r\n\r\n123", s);
Assert.assertTrue(conn.isConsistent());
@@ -353,8 +353,8 @@ public class TestDefaultBHttpClientConnection {
@Test
public void testTerminateRequestContentLengthLong() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -372,7 +372,7 @@ public class TestDefaultBHttpClientConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nContent-Length: " +
"3000\r\n\r\n", s);
Assert.assertFalse(conn.isConsistent());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
index 9898218..7ddce42 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
@@ -76,8 +76,8 @@ public class TestDefaultBHttpServerConnection {
@Test
public void testReadRequestHead() throws Exception {
final String s = "GET / HTTP/1.1\r\nUser-Agent: test\r\n\r\n";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -94,8 +94,8 @@ public class TestDefaultBHttpServerConnection {
@Test
public void testReadRequestEntityWithContentLength() throws Exception {
final String s = "POST / HTTP/1.1\r\nUser-Agent: test\r\nContent-Length: 3\r\n\r\n123";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -125,8 +125,8 @@ public class TestDefaultBHttpServerConnection {
public void testReadRequestEntityChunckCoded() throws Exception {
final String s = "POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nTransfer-Encoding: " +
"chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -157,8 +157,8 @@ public class TestDefaultBHttpServerConnection {
public void testReadRequestEntityIdentity() throws Exception {
final String s = "POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nTransfer-Encoding: " +
"identity\r\n\r\n123";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -179,8 +179,8 @@ public class TestDefaultBHttpServerConnection {
@Test
public void testReadRequestNoEntity() throws Exception {
final String s = "POST /stuff HTTP/1.1\r\nUser-Agent: test\r\n\r\n";
- final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
- Mockito.when(socket.getInputStream()).thenReturn(instream);
+ final ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII));
+ Mockito.when(socket.getInputStream()).thenReturn(inStream);
conn.bind(socket);
@@ -203,8 +203,8 @@ public class TestDefaultBHttpServerConnection {
@Test
public void testWriteResponseHead() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -217,14 +217,14 @@ public class TestDefaultBHttpServerConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getResponseCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("HTTP/1.1 200 OK\r\nUser-Agent: test\r\n\r\n", s);
}
@Test
public void testWriteResponse100Head() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -236,14 +236,14 @@ public class TestDefaultBHttpServerConnection {
conn.flush();
Assert.assertEquals(0, conn.getEndpointDetails().getResponseCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("HTTP/1.1 100 Go on\r\n\r\n", s);
}
@Test
public void testWriteResponseEntityWithContentLength() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -259,14 +259,14 @@ public class TestDefaultBHttpServerConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getResponseCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("HTTP/1.1 200 OK\r\nServer: test\r\nContent-Length: 3\r\n\r\n123", s);
}
@Test
public void testWriteResponseEntityChunkCoded() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -282,15 +282,15 @@ public class TestDefaultBHttpServerConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getResponseCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("HTTP/1.1 200 OK\r\nServer: test\r\nTransfer-Encoding: " +
"chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n", s);
}
@Test(expected = NotImplementedException.class)
public void testWriteResponseEntityIdentity() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -308,8 +308,8 @@ public class TestDefaultBHttpServerConnection {
@Test
public void testWriteResponseNoEntity() throws Exception {
- final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
- Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+ final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Mockito.when(socket.getOutputStream()).thenReturn(outStream);
conn.bind(socket);
@@ -323,7 +323,7 @@ public class TestDefaultBHttpServerConnection {
conn.flush();
Assert.assertEquals(1, conn.getEndpointDetails().getResponseCount());
- final String s = new String(outstream.toByteArray(), "ASCII");
+ final String s = new String(outStream.toByteArray(), "ASCII");
Assert.assertEquals("HTTP/1.1 200 OK\r\nServer: test\r\n\r\n", s);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java
index 1dcd472..b73feef 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestHttpService.java
@@ -133,8 +133,8 @@ public class TestHttpService {
public void testExecutionEntityEnclosingRequest() throws Exception {
final HttpCoreContext context = HttpCoreContext.create();
final ClassicHttpRequest request = new BasicClassicHttpRequest("POST", "/");
- final InputStream instream = Mockito.mock(InputStream.class);
- final InputStreamEntity entity = new InputStreamEntity(instream, -1);
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ final InputStreamEntity entity = new InputStreamEntity(inStream, -1);
request.setEntity(entity);
Mockito.when(conn.receiveRequestHeader()).thenReturn(request);
@@ -159,7 +159,7 @@ public class TestHttpService {
Assert.assertSame(request, context.getRequest());
Mockito.verify(httprocessor).process(request, request.getEntity(), context);
- Mockito.verify(instream).close();
+ Mockito.verify(inStream).close();
Mockito.verify(httprocessor).process(response, response.getEntity(), context);
Mockito.verify(conn).sendResponseHeader(response);
Mockito.verify(conn).sendResponseEntity(response);
@@ -173,8 +173,8 @@ public class TestHttpService {
final HttpCoreContext context = HttpCoreContext.create();
final ClassicHttpRequest request = new BasicClassicHttpRequest("POST", "/");
request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
- final InputStream instream = Mockito.mock(InputStream.class);
- final InputStreamEntity entity = new InputStreamEntity(instream, -1);
+ final InputStream inStream = Mockito.mock(InputStream.class);
+ final InputStreamEntity entity = new InputStreamEntity(inStream, -1);
request.setEntity(entity);
Mockito.when(conn.receiveRequestHeader()).thenReturn(request);
@@ -203,7 +203,7 @@ public class TestHttpService {
Assert.assertSame(request, context.getRequest());
Mockito.verify(httprocessor).process(request, request.getEntity(), context);
- Mockito.verify(instream).close();
+ Mockito.verify(inStream).close();
Mockito.verify(httprocessor).process(response, response.getEntity(), context);
Mockito.verify(conn).sendResponseHeader(response);
Mockito.verify(conn).sendResponseEntity(response);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/34603734/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestIdentityInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestIdentityInputStream.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestIdentityInputStream.java
index b15a7bf..a00f1f3 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestIdentityInputStream.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestIdentityInputStream.java
@@ -44,8 +44,8 @@ public class TestIdentityInputStream {
public void testBasicRead() throws Exception {
final byte[] input = new byte[] {'a', 'b', 'c'};
final ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
- final IdentityInputStream in = new IdentityInputStream(inbuffer, inputStream);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
+ final IdentityInputStream in = new IdentityInputStream(inBuffer, inputStream);
final byte[] tmp = new byte[2];
Assert.assertEquals(2, in.read(tmp, 0, tmp.length));
Assert.assertEquals('a', tmp[0]);
@@ -62,8 +62,8 @@ public class TestIdentityInputStream {
public void testClosedCondition() throws Exception {
final byte[] input = new byte[] {'a', 'b', 'c'};
final ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(16);
- final IdentityInputStream in = new IdentityInputStream(inbuffer, inputStream);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(16);
+ final IdentityInputStream in = new IdentityInputStream(inBuffer, inputStream);
in.close();
in.close();
@@ -86,8 +86,8 @@ public class TestIdentityInputStream {
public void testAvailable() throws Exception {
final byte[] input = new byte[] {'a', 'b', 'c'};
final ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(new BasicHttpTransportMetrics(), 16, 16, 1024, null);
- final IdentityInputStream in = new IdentityInputStream(inbuffer, inputStream);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(new BasicHttpTransportMetrics(), 16, 16, 1024, null);
+ final IdentityInputStream in = new IdentityInputStream(inBuffer, inputStream);
in.read();
Assert.assertEquals(2, in.available());
in.close();
@@ -97,8 +97,8 @@ public class TestIdentityInputStream {
public void testAvailableInStream() throws Exception {
final byte[] input = new byte[] {'a', 'b', 'c', 'd', 'e', 'f'};
final ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
- final SessionInputBuffer inbuffer = new SessionInputBufferImpl(new BasicHttpTransportMetrics(), 16, 0, 1024, null);
- final IdentityInputStream in = new IdentityInputStream(inbuffer, inputStream);
+ final SessionInputBuffer inBuffer = new SessionInputBufferImpl(new BasicHttpTransportMetrics(), 16, 0, 1024, null);
+ final IdentityInputStream in = new IdentityInputStream(inBuffer, inputStream);
final byte[] tmp = new byte[3];
Assert.assertEquals(3, in.read(tmp));
Assert.assertEquals(3, in.available());