You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/08/14 07:51:40 UTC
[05/12] 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
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
index fecec64..6f2b816 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
@@ -77,7 +77,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
private final EntitySerializer entityserializer;
private final EntityDeserializer entitydeserializer;
- private SessionInputBuffer inbuffer = null;
+ private SessionInputBuffer inBuffer = null;
private SessionOutputBuffer outbuffer = null;
private EofSensor eofSensor = null;
private HttpMessageParser<HttpResponse> responseParser = null;
@@ -212,27 +212,27 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
* methods to initialize HTTP request writer and response parser for this
* connection.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param outbuffer the session output buffer.
* @param params HTTP parameters.
*/
protected void init(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final SessionOutputBuffer outbuffer,
final HttpParams params) {
- this.inbuffer = Args.notNull(inbuffer, "Input session buffer");
+ this.inBuffer = Args.notNull(inBuffer, "Input session buffer");
this.outbuffer = Args.notNull(outbuffer, "Output session buffer");
- if (inbuffer instanceof EofSensor) {
- this.eofSensor = (EofSensor) inbuffer;
+ if (inBuffer instanceof EofSensor) {
+ this.eofSensor = (EofSensor) inBuffer;
}
this.responseParser = createResponseParser(
- inbuffer,
+ inBuffer,
createHttpResponseFactory(),
params);
this.requestWriter = createRequestWriter(
outbuffer, params);
this.metrics = createConnectionMetrics(
- inbuffer.getMetrics(),
+ inBuffer.getMetrics(),
outbuffer.getMetrics());
}
@@ -240,7 +240,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
public boolean isResponseAvailable(final int timeout) throws IOException {
assertOpen();
try {
- return this.inbuffer.isDataAvailable(timeout);
+ return this.inBuffer.isDataAvailable(timeout);
} catch (final SocketTimeoutException ex) {
return false;
}
@@ -295,7 +295,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
throws HttpException, IOException {
Args.notNull(response, "HTTP response");
assertOpen();
- final HttpEntity entity = this.entitydeserializer.deserialize(this.inbuffer, response);
+ final HttpEntity entity = this.entitydeserializer.deserialize(this.inBuffer, response);
response.setEntity(entity);
}
@@ -312,7 +312,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
return true;
}
try {
- this.inbuffer.isDataAvailable(1);
+ this.inBuffer.isDataAvailable(1);
return isEof();
} catch (final SocketTimeoutException ex) {
return false;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
index 28465a4..04cef17 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
@@ -76,7 +76,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
private final EntitySerializer entityserializer;
private final EntityDeserializer entitydeserializer;
- private SessionInputBuffer inbuffer = null;
+ private SessionInputBuffer inBuffer = null;
private SessionOutputBuffer outbuffer = null;
private EofSensor eofSensor = null;
private HttpMessageParser<HttpRequest> requestParser = null;
@@ -212,27 +212,27 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
* methods to initialize HTTP request parser and response writer for this
* connection.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param outbuffer the session output buffer.
* @param params HTTP parameters.
*/
protected void init(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final SessionOutputBuffer outbuffer,
final HttpParams params) {
- this.inbuffer = Args.notNull(inbuffer, "Input session buffer");
+ this.inBuffer = Args.notNull(inBuffer, "Input session buffer");
this.outbuffer = Args.notNull(outbuffer, "Output session buffer");
- if (inbuffer instanceof EofSensor) {
- this.eofSensor = (EofSensor) inbuffer;
+ if (inBuffer instanceof EofSensor) {
+ this.eofSensor = (EofSensor) inBuffer;
}
this.requestParser = createRequestParser(
- inbuffer,
+ inBuffer,
createHttpRequestFactory(),
params);
this.responseWriter = createResponseWriter(
outbuffer, params);
this.metrics = createConnectionMetrics(
- inbuffer.getMetrics(),
+ inBuffer.getMetrics(),
outbuffer.getMetrics());
}
@@ -250,7 +250,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
throws HttpException, IOException {
Args.notNull(request, "HTTP request");
assertOpen();
- final HttpEntity entity = this.entitydeserializer.deserialize(this.inbuffer, request);
+ final HttpEntity entity = this.entitydeserializer.deserialize(this.inBuffer, request);
request.setEntity(entity);
}
@@ -300,7 +300,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
return true;
}
try {
- this.inbuffer.isDataAvailable(1);
+ this.inBuffer.isDataAvailable(1);
return isEof();
} catch (final IOException ex) {
return true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
index 0d98a88..ac0d97e 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
@@ -83,16 +83,16 @@ public class SocketHttpClientConnection
* @see SocketInputBuffer#SocketInputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session input buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionInputBuffer createSessionInputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketInputBuffer(socket, buffersize, params);
+ return new SocketInputBuffer(socket, bufferSize, params);
}
/**
@@ -105,16 +105,16 @@ public class SocketHttpClientConnection
* @see SocketOutputBuffer#SocketOutputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session output buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketOutputBuffer(socket, buffersize, params);
+ return new SocketOutputBuffer(socket, bufferSize, params);
}
/**
@@ -142,10 +142,10 @@ public class SocketHttpClientConnection
Args.notNull(params, "HTTP parameters");
this.socket = socket;
- final int buffersize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
+ final int bufferSize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
init(
- createSessionInputBuffer(socket, buffersize, params),
- createSessionOutputBuffer(socket, buffersize, params),
+ createSessionInputBuffer(socket, bufferSize, params),
+ createSessionOutputBuffer(socket, bufferSize, params),
params);
this.open = true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
index c343058..dcf190c 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
@@ -74,16 +74,16 @@ public class SocketHttpServerConnection extends
* @see SocketInputBuffer#SocketInputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session input buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionInputBuffer createSessionInputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketInputBuffer(socket, buffersize, params);
+ return new SocketInputBuffer(socket, bufferSize, params);
}
/**
@@ -96,16 +96,16 @@ public class SocketHttpServerConnection extends
* @see SocketOutputBuffer#SocketOutputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session output buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketOutputBuffer(socket, buffersize, params);
+ return new SocketOutputBuffer(socket, bufferSize, params);
}
/**
@@ -131,10 +131,10 @@ public class SocketHttpServerConnection extends
Args.notNull(params, "HTTP parameters");
this.socket = socket;
- final int buffersize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
+ final int bufferSize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
init(
- createSessionInputBuffer(socket, buffersize, params),
- createSessionOutputBuffer(socket, buffersize, params),
+ createSessionInputBuffer(socket, bufferSize, params),
+ createSessionOutputBuffer(socket, bufferSize, params),
params);
this.open = true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
index f9c8f51..f538e5d 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
@@ -82,14 +82,14 @@ public class EntityDeserializer {
* This method is called by the public
* {@link #deserialize(SessionInputBuffer, HttpMessage)}.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param message the message.
* @return HTTP entity.
* @throws HttpException in case of HTTP protocol violation.
* @throws IOException in case of an I/O error.
*/
protected BasicHttpEntity doDeserialize(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final HttpMessage message) throws HttpException, IOException {
final BasicHttpEntity entity = new BasicHttpEntity();
@@ -97,15 +97,15 @@ public class EntityDeserializer {
if (len == ContentLengthStrategy.CHUNKED) {
entity.setChunked(true);
entity.setContentLength(-1);
- entity.setContent(new ChunkedInputStream(inbuffer));
+ entity.setContent(new ChunkedInputStream(inBuffer));
} else if (len == ContentLengthStrategy.IDENTITY) {
entity.setChunked(false);
entity.setContentLength(-1);
- entity.setContent(new IdentityInputStream(inbuffer));
+ entity.setContent(new IdentityInputStream(inBuffer));
} else {
entity.setChunked(false);
entity.setContentLength(len);
- entity.setContent(new ContentLengthInputStream(inbuffer, len));
+ entity.setContent(new ContentLengthInputStream(inBuffer, len));
}
final Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
@@ -127,18 +127,18 @@ public class EntityDeserializer {
* <p>
* The content of the entity is NOT retrieved by this method.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param message the message.
* @return HTTP entity.
* @throws HttpException in case of HTTP protocol violation.
* @throws IOException in case of an I/O error.
*/
public HttpEntity deserialize(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final HttpMessage message) throws HttpException, IOException {
- Args.notNull(inbuffer, "Session input buffer");
+ Args.notNull(inBuffer, "Session input buffer");
Args.notNull(message, "HTTP message");
- return doDeserialize(inbuffer, message);
+ return doDeserialize(inBuffer, message);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntitySerializer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntitySerializer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntitySerializer.java
index 156734c..cdb6eda 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntitySerializer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntitySerializer.java
@@ -114,9 +114,9 @@ public class EntitySerializer {
Args.notNull(outbuffer, "Session output buffer");
Args.notNull(message, "HTTP message");
Args.notNull(entity, "HTTP entity");
- final OutputStream outstream = doSerialize(outbuffer, message);
- entity.writeTo(outstream);
- outstream.close();
+ final OutputStream outStream = doSerialize(outbuffer, message);
+ entity.writeTo(outStream);
+ outStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
index 6ce8018..533a233 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
@@ -64,9 +64,9 @@ import org.apache.http.util.CharArrayBuffer;
@Deprecated
public abstract class AbstractSessionInputBuffer implements SessionInputBuffer, BufferInfo {
- private InputStream instream;
+ private InputStream inStream;
private byte[] buffer;
- private ByteArrayBuffer linebuffer;
+ private ByteArrayBuffer lineBuffer;
private Charset charset;
private boolean ascii;
private int maxLineLen;
@@ -75,8 +75,8 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
private CodingErrorAction onMalformedCharAction;
private CodingErrorAction onUnmappableCharAction;
- private int bufferpos;
- private int bufferlen;
+ private int bufferPos;
+ private int bufferLen;
private CharsetDecoder decoder;
private CharBuffer cbuf;
@@ -86,19 +86,19 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
/**
* Initializes this session input buffer.
*
- * @param instream the source input stream.
- * @param buffersize the size of the internal buffer.
+ * @param inputStream the source input stream.
+ * @param bufferSize the size of the internal buffer.
* @param params HTTP parameters.
*/
- protected void init(final InputStream instream, final int buffersize, final HttpParams params) {
- Args.notNull(instream, "Input stream");
- Args.notNegative(buffersize, "Buffer size");
+ protected void init(final InputStream inputStream, final int bufferSize, final HttpParams params) {
+ Args.notNull(inputStream, "Input stream");
+ Args.notNegative(bufferSize, "Buffer size");
Args.notNull(params, "HTTP parameters");
- this.instream = instream;
- this.buffer = new byte[buffersize];
- this.bufferpos = 0;
- this.bufferlen = 0;
- this.linebuffer = new ByteArrayBuffer(buffersize);
+ this.inStream = inputStream;
+ this.buffer = new byte[bufferSize];
+ this.bufferPos = 0;
+ this.bufferLen = 0;
+ this.lineBuffer = new ByteArrayBuffer(bufferSize);
final String charset = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
this.charset = charset != null ? Charset.forName(charset) : Consts.ASCII;
this.ascii = this.charset.equals(Consts.ASCII);
@@ -134,7 +134,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
*/
@Override
public int length() {
- return this.bufferlen - this.bufferpos;
+ return this.bufferLen - this.bufferPos;
}
/**
@@ -147,29 +147,28 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
protected int fillBuffer() throws IOException {
// compact the buffer if necessary
- if (this.bufferpos > 0) {
- final int len = this.bufferlen - this.bufferpos;
+ if (this.bufferPos > 0) {
+ final int len = this.bufferLen - this.bufferPos;
if (len > 0) {
- System.arraycopy(this.buffer, this.bufferpos, this.buffer, 0, len);
+ System.arraycopy(this.buffer, this.bufferPos, this.buffer, 0, len);
}
- this.bufferpos = 0;
- this.bufferlen = len;
+ this.bufferPos = 0;
+ this.bufferLen = len;
}
- final int l;
- final int off = this.bufferlen;
+ final int readLen;
+ final int off = this.bufferLen;
final int len = this.buffer.length - off;
- l = this.instream.read(this.buffer, off, len);
- if (l == -1) {
+ readLen = this.inStream.read(this.buffer, off, len);
+ if (readLen == -1) {
return -1;
- } else {
- this.bufferlen = off + l;
- this.metrics.incrementBytesTransferred(l);
- return l;
}
+ this.bufferLen = off + readLen;
+ this.metrics.incrementBytesTransferred(readLen);
+ return readLen;
}
protected boolean hasBufferedData() {
- return this.bufferpos < this.bufferlen;
+ return this.bufferPos < this.bufferLen;
}
@Override
@@ -181,7 +180,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
return -1;
}
}
- return this.buffer[this.bufferpos++] & 0xff;
+ return this.buffer[this.bufferPos++] & 0xff;
}
@Override
@@ -190,32 +189,31 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
return 0;
}
if (hasBufferedData()) {
- final int chunk = Math.min(len, this.bufferlen - this.bufferpos);
- System.arraycopy(this.buffer, this.bufferpos, b, off, chunk);
- this.bufferpos += chunk;
+ final int chunk = Math.min(len, this.bufferLen - this.bufferPos);
+ System.arraycopy(this.buffer, this.bufferPos, b, off, chunk);
+ this.bufferPos += chunk;
return chunk;
}
// If the remaining capacity is big enough, read directly from the
// underlying input stream bypassing the buffer.
if (len > this.minChunkLimit) {
- final int read = this.instream.read(b, off, len);
+ final int read = this.inStream.read(b, off, len);
if (read > 0) {
this.metrics.incrementBytesTransferred(read);
}
return read;
- } else {
- // otherwise read to the buffer first
- while (!hasBufferedData()) {
- final int noRead = fillBuffer();
- if (noRead == -1) {
- return -1;
- }
+ }
+ // otherwise read to the buffer first
+ while (!hasBufferedData()) {
+ final int noRead = fillBuffer();
+ if (noRead == -1) {
+ return -1;
}
- final int chunk = Math.min(len, this.bufferlen - this.bufferpos);
- System.arraycopy(this.buffer, this.bufferpos, b, off, chunk);
- this.bufferpos += chunk;
- return chunk;
}
+ final int chunk = Math.min(len, this.bufferLen - this.bufferPos);
+ System.arraycopy(this.buffer, this.bufferPos, b, off, chunk);
+ this.bufferPos += chunk;
+ return chunk;
}
@Override
@@ -227,7 +225,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
}
private int locateLF() {
- for (int i = this.bufferpos; i < this.bufferlen; i++) {
+ for (int i = this.bufferPos; i < this.bufferLen; i++) {
if (this.buffer[i] == HTTP.LF) {
return i;
}
@@ -260,31 +258,31 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
final int i = locateLF();
if (i != -1) {
// end of line found.
- if (this.linebuffer.isEmpty()) {
+ if (this.lineBuffer.isEmpty()) {
// the entire line is preset in the read buffer
return lineFromReadBuffer(charbuffer, i);
}
retry = false;
- final int len = i + 1 - this.bufferpos;
- this.linebuffer.append(this.buffer, this.bufferpos, len);
- this.bufferpos = i + 1;
+ final int len = i + 1 - this.bufferPos;
+ this.lineBuffer.append(this.buffer, this.bufferPos, len);
+ this.bufferPos = i + 1;
} else {
// end of line not found
if (hasBufferedData()) {
- final int len = this.bufferlen - this.bufferpos;
- this.linebuffer.append(this.buffer, this.bufferpos, len);
- this.bufferpos = this.bufferlen;
+ final int len = this.bufferLen - this.bufferPos;
+ this.lineBuffer.append(this.buffer, this.bufferPos, len);
+ this.bufferPos = this.bufferLen;
}
noRead = fillBuffer();
if (noRead == -1) {
retry = false;
}
}
- if (this.maxLineLen > 0 && this.linebuffer.length() >= this.maxLineLen) {
+ if (this.maxLineLen > 0 && this.lineBuffer.length() >= this.maxLineLen) {
throw new IOException("Maximum line length limit exceeded");
}
}
- if (noRead == -1 && this.linebuffer.isEmpty()) {
+ if (noRead == -1 && this.lineBuffer.isEmpty()) {
// indicate the end of stream
return -1;
}
@@ -307,33 +305,33 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
throws IOException {
// discard LF if found
- int len = this.linebuffer.length();
+ int len = this.lineBuffer.length();
if (len > 0) {
- if (this.linebuffer.byteAt(len - 1) == HTTP.LF) {
+ if (this.lineBuffer.byteAt(len - 1) == HTTP.LF) {
len--;
}
// discard CR if found
if (len > 0) {
- if (this.linebuffer.byteAt(len - 1) == HTTP.CR) {
+ if (this.lineBuffer.byteAt(len - 1) == HTTP.CR) {
len--;
}
}
}
if (this.ascii) {
- charbuffer.append(this.linebuffer, 0, len);
+ charbuffer.append(this.lineBuffer, 0, len);
} else {
- final ByteBuffer bbuf = ByteBuffer.wrap(this.linebuffer.buffer(), 0, len);
+ final ByteBuffer bbuf = ByteBuffer.wrap(this.lineBuffer.buffer(), 0, len);
len = appendDecoded(charbuffer, bbuf);
}
- this.linebuffer.clear();
+ this.lineBuffer.clear();
return len;
}
private int lineFromReadBuffer(final CharArrayBuffer charbuffer, final int position)
throws IOException {
- final int off = this.bufferpos;
+ final int off = this.bufferPos;
int i = position;
- this.bufferpos = i + 1;
+ this.bufferPos = i + 1;
if (i > off && this.buffer[i - 1] == HTTP.CR) {
// skip CR if found
i--;
@@ -392,8 +390,8 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
@Override
public String readLine() throws IOException {
final CharArrayBuffer charbuffer = new CharArrayBuffer(64);
- final int l = readLine(charbuffer);
- if (l != -1) {
+ final int readLen = readLine(charbuffer);
+ if (readLen != -1) {
return charbuffer.toString();
} else {
return null;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
index 38c14de..9537058 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
@@ -65,7 +65,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
private static final byte[] CRLF = new byte[] {HTTP.CR, HTTP.LF};
- private OutputStream outstream;
+ private OutputStream outStream;
private ByteArrayBuffer buffer;
private Charset charset;
private boolean ascii;
@@ -78,17 +78,17 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
private ByteBuffer bbuf;
protected AbstractSessionOutputBuffer(
- final OutputStream outstream,
- final int buffersize,
+ final OutputStream outStream,
+ final int bufferSize,
final Charset charset,
final int minChunkLimit,
final CodingErrorAction malformedCharAction,
final CodingErrorAction unmappableCharAction) {
super();
- Args.notNull(outstream, "Input stream");
- Args.notNegative(buffersize, "Buffer size");
- this.outstream = outstream;
- this.buffer = new ByteArrayBuffer(buffersize);
+ Args.notNull(outStream, "Input stream");
+ Args.notNegative(bufferSize, "Buffer size");
+ this.outStream = outStream;
+ this.buffer = new ByteArrayBuffer(bufferSize);
this.charset = charset != null ? charset : Consts.ASCII;
this.ascii = this.charset.equals(Consts.ASCII);
this.encoder = null;
@@ -103,12 +103,12 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
public AbstractSessionOutputBuffer() {
}
- protected void init(final OutputStream outstream, final int buffersize, final HttpParams params) {
- Args.notNull(outstream, "Input stream");
- Args.notNegative(buffersize, "Buffer size");
+ protected void init(final OutputStream outStream, final int bufferSize, final HttpParams params) {
+ Args.notNull(outStream, "Input stream");
+ Args.notNegative(bufferSize, "Buffer size");
Args.notNull(params, "HTTP parameters");
- this.outstream = outstream;
- this.buffer = new ByteArrayBuffer(buffersize);
+ this.outStream = outStream;
+ this.buffer = new ByteArrayBuffer(bufferSize);
final String charset = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
this.charset = charset != null ? Charset.forName(charset) : Consts.ASCII;
this.ascii = this.charset.equals(Consts.ASCII);
@@ -157,7 +157,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
protected void flushBuffer() throws IOException {
final int len = this.buffer.length();
if (len > 0) {
- this.outstream.write(this.buffer.buffer(), 0, len);
+ this.outStream.write(this.buffer.buffer(), 0, len);
this.buffer.clear();
this.metrics.incrementBytesTransferred(len);
}
@@ -166,7 +166,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
@Override
public void flush() throws IOException {
flushBuffer();
- this.outstream.flush();
+ this.outStream.flush();
}
@Override
@@ -181,7 +181,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
// flush the buffer
flushBuffer();
// write directly to the out stream
- this.outstream.write(b, off, len);
+ this.outStream.write(b, off, len);
this.metrics.incrementBytesTransferred(len);
} else {
// Do not let the buffer grow unnecessarily
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
index 5337fb5..553719b 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
@@ -88,8 +88,8 @@ public class HttpRequestParser extends AbstractMessageParser<HttpMessage> {
throws IOException, HttpException, ParseException {
this.lineBuf.clear();
- final int i = sessionBuffer.readLine(this.lineBuf);
- if (i == -1) {
+ final int readLen = sessionBuffer.readLine(this.lineBuf);
+ if (readLen == -1) {
throw new ConnectionClosedException("Client closed connection");
}
final ParserCursor cursor = new ParserCursor(0, this.lineBuf.length());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
index 0b6399b..e61fbd6 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
@@ -88,8 +88,8 @@ public class HttpResponseParser extends AbstractMessageParser<HttpMessage> {
throws IOException, HttpException, ParseException {
this.lineBuf.clear();
- final int i = sessionBuffer.readLine(this.lineBuf);
- if (i == -1) {
+ final int readLen = sessionBuffer.readLine(this.lineBuf);
+ if (readLen == -1) {
throw new NoHttpResponseException("The target server failed to respond");
}
//create the status line from the status string
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
index 246ca0a..b5d8eae 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
@@ -53,7 +53,7 @@ public class SocketInputBuffer extends AbstractSessionInputBuffer implements Eof
* Creates an instance of this class.
*
* @param socket the socket to read data from.
- * @param buffersize the size of the internal buffer. If this number is less
+ * @param bufferSize the size of the internal buffer. If this number is less
* than {@code 0} it is set to the value of
* {@link Socket#getReceiveBufferSize()}. If resultant number is less
* than {@code 1024} it is set to {@code 1024}.
@@ -61,13 +61,13 @@ public class SocketInputBuffer extends AbstractSessionInputBuffer implements Eof
*/
public SocketInputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
super();
Args.notNull(socket, "Socket");
this.socket = socket;
this.eof = false;
- int n = buffersize;
+ int n = bufferSize;
if (n < 0) {
n = socket.getReceiveBufferSize();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
index 95c63a7..4bb78e5 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
@@ -48,7 +48,7 @@ public class SocketOutputBuffer extends AbstractSessionOutputBuffer {
* Creates an instance of this class.
*
* @param socket the socket to write data to.
- * @param buffersize the size of the internal buffer. If this number is less
+ * @param bufferSize the size of the internal buffer. If this number is less
* than {@code 0} it is set to the value of
* {@link Socket#getSendBufferSize()}. If resultant number is less
* than {@code 1024} it is set to {@code 1024}.
@@ -56,11 +56,11 @@ public class SocketOutputBuffer extends AbstractSessionOutputBuffer {
*/
public SocketOutputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
super();
Args.notNull(socket, "Socket");
- int n = buffersize;
+ int n = bufferSize;
if (n < 0) {
n = socket.getSendBufferSize();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/HttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/HttpEntity.java b/httpcore/src/main/java/org/apache/http/HttpEntity.java
index 3e4f266..0fa2606 100644
--- a/httpcore/src/main/java/org/apache/http/HttpEntity.java
+++ b/httpcore/src/main/java/org/apache/http/HttpEntity.java
@@ -151,11 +151,11 @@ public interface HttpEntity {
* all allocated resources are properly deallocated when this method
* returns.
*
- * @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/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java b/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
index 3695940..71eb32a 100644
--- a/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
@@ -99,25 +99,25 @@ 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
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = getContent();
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = getContent();
try {
int l;
final byte[] tmp = new byte[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/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java b/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
index 93dc158..4466aec 100644
--- a/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
@@ -107,12 +107,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/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java b/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
index 226e8bd..c1d1573 100644
--- a/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
@@ -107,10 +107,10 @@ public class ByteArrayEntity extends AbstractHttpEntity implements Cloneable {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- outstream.write(this.b, this.off, this.len);
- outstream.flush();
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ outStream.write(this.b, this.off, this.len);
+ outStream.flush();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/ContentProducer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/ContentProducer.java b/httpcore/src/main/java/org/apache/http/entity/ContentProducer.java
index 9cd4e14..dc98ab7 100644
--- a/httpcore/src/main/java/org/apache/http/entity/ContentProducer.java
+++ b/httpcore/src/main/java/org/apache/http/entity/ContentProducer.java
@@ -39,6 +39,6 @@ import java.io.OutputStream;
*/
public interface ContentProducer {
- void writeTo(OutputStream outstream) throws IOException;
+ void writeTo(OutputStream outStream) throws IOException;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/EntityTemplate.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/EntityTemplate.java b/httpcore/src/main/java/org/apache/http/entity/EntityTemplate.java
index 19e49f0..a5a4c24 100644
--- a/httpcore/src/main/java/org/apache/http/entity/EntityTemplate.java
+++ b/httpcore/src/main/java/org/apache/http/entity/EntityTemplate.java
@@ -68,9 +68,9 @@ public class EntityTemplate extends AbstractHttpEntity {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- this.contentproducer.writeTo(outstream);
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ this.contentproducer.writeTo(outStream);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/FileEntity.java b/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
index 6ab593a..9ad2210 100644
--- a/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
@@ -89,18 +89,18 @@ public class FileEntity extends AbstractHttpEntity implements Cloneable {
}
@Override
- public void writeTo(final OutputStream outstream) throws IOException {
- Args.notNull(outstream, "Output stream");
- final InputStream instream = new FileInputStream(this.file);
+ public void writeTo(final OutputStream outStream) throws IOException {
+ Args.notNull(outStream, "Output stream");
+ final InputStream inStream = new FileInputStream(this.file);
try {
final byte[] tmp = new byte[OUTPUT_BUFFER_SIZE];
int l;
- while ((l = instream.read(tmp)) != -1) {
- outstream.write(tmp, 0, l);
+ while ((l = inStream.read(tmp)) != -1) {
+ outStream.write(tmp, 0, l);
}
- outstream.flush();
+ outStream.flush();
} finally {
- instream.close();
+ inStream.close();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java b/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
index 61521bf..6081cbb 100644
--- a/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
+++ b/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
@@ -89,9 +89,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/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java b/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
index 7942bcb..0bd8e49 100644
--- a/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
@@ -46,50 +46,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());
@@ -122,31 +122,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/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java b/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
index 25bb4a5..573df42 100644
--- a/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
@@ -114,15 +114,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/9dc8fe89/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/StringEntity.java b/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
index 0251676..f799839 100644
--- a/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
@@ -162,10 +162,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/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java b/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
index 4176286..165f9a9 100644
--- a/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
+++ b/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
@@ -75,7 +75,7 @@ import org.apache.http.util.NetUtils;
*/
public class BHttpConnectionBase implements HttpInetConnection {
- private final SessionInputBufferImpl inbuffer;
+ private final SessionInputBufferImpl inBuffer;
private final SessionOutputBufferImpl outbuffer;
private final MessageConstraints messageConstraints;
private final HttpConnectionMetricsImpl connMetrics;
@@ -86,7 +86,7 @@ public class BHttpConnectionBase implements HttpInetConnection {
/**
* Creates new instance of BHttpConnectionBase.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
@@ -100,7 +100,7 @@ public class BHttpConnectionBase implements HttpInetConnection {
* {@link StrictContentLengthStrategy#INSTANCE} will be used.
*/
protected BHttpConnectionBase(
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
@@ -108,12 +108,12 @@ public class BHttpConnectionBase implements HttpInetConnection {
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
super();
- Args.positive(buffersize, "Buffer size");
+ Args.positive(bufferSize, "Buffer size");
final HttpTransportMetricsImpl inTransportMetrics = new HttpTransportMetricsImpl();
final HttpTransportMetricsImpl outTransportMetrics = new HttpTransportMetricsImpl();
- this.inbuffer = new SessionInputBufferImpl(inTransportMetrics, buffersize, -1,
+ this.inBuffer = new SessionInputBufferImpl(inTransportMetrics, bufferSize, -1,
messageConstraints != null ? messageConstraints : MessageConstraints.DEFAULT, chardecoder);
- this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, buffersize, fragmentSizeHint,
+ this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, bufferSize, fragmentSizeHint,
charencoder);
this.messageConstraints = messageConstraints;
this.connMetrics = new HttpConnectionMetricsImpl(inTransportMetrics, outTransportMetrics);
@@ -129,8 +129,8 @@ public class BHttpConnectionBase implements HttpInetConnection {
if (socket == null) {
throw new ConnectionClosedException();
}
- if (!this.inbuffer.isBound()) {
- this.inbuffer.bind(getSocketInputStream(socket));
+ if (!this.inBuffer.isBound()) {
+ this.inBuffer.bind(getSocketInputStream(socket));
}
if (!this.outbuffer.isBound()) {
this.outbuffer.bind(getSocketOutputStream(socket));
@@ -158,12 +158,12 @@ public class BHttpConnectionBase implements HttpInetConnection {
protected void bind(final Socket socket) throws IOException {
Args.notNull(socket, "Socket");
this.socketHolder.set(socket);
- this.inbuffer.bind(null);
+ this.inBuffer.bind(null);
this.outbuffer.bind(null);
}
protected SessionInputBuffer getSessionInputBuffer() {
- return this.inbuffer;
+ return this.inBuffer;
}
protected SessionOutputBuffer getSessionOutputBuffer() {
@@ -202,15 +202,15 @@ public class BHttpConnectionBase implements HttpInetConnection {
protected InputStream createInputStream(
final long len,
- final SessionInputBuffer inbuffer) {
+ final SessionInputBuffer inBuffer) {
if (len == ContentLengthStrategy.CHUNKED) {
- return new ChunkedInputStream(inbuffer, this.messageConstraints);
+ return new ChunkedInputStream(inBuffer, this.messageConstraints);
} else if (len == ContentLengthStrategy.IDENTITY) {
- return new IdentityInputStream(inbuffer);
+ return new IdentityInputStream(inBuffer);
} else if (len == 0L) {
return EmptyInputStream.INSTANCE;
} else {
- return new ContentLengthInputStream(inbuffer, len);
+ return new ContentLengthInputStream(inBuffer, len);
}
}
@@ -218,19 +218,19 @@ public class BHttpConnectionBase implements HttpInetConnection {
final BasicHttpEntity entity = new BasicHttpEntity();
final long len = this.incomingContentStrategy.determineLength(message);
- final InputStream instream = createInputStream(len, this.inbuffer);
+ final InputStream inStream = createInputStream(len, this.inBuffer);
if (len == ContentLengthStrategy.CHUNKED) {
entity.setChunked(true);
entity.setContentLength(-1);
- entity.setContent(instream);
+ entity.setContent(inStream);
} else if (len == ContentLengthStrategy.IDENTITY) {
entity.setChunked(false);
entity.setContentLength(-1);
- entity.setContent(instream);
+ entity.setContent(inStream);
} else {
entity.setChunked(false);
entity.setContentLength(len);
- entity.setContent(instream);
+ entity.setContent(inStream);
}
final Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
@@ -315,7 +315,7 @@ public class BHttpConnectionBase implements HttpInetConnection {
final Socket socket = this.socketHolder.getAndSet(null);
if (socket != null) {
try {
- this.inbuffer.clear();
+ this.inBuffer.clear();
this.outbuffer.flush();
try {
try {
@@ -340,18 +340,18 @@ public class BHttpConnectionBase implements HttpInetConnection {
final int oldtimeout = socket.getSoTimeout();
try {
socket.setSoTimeout(timeout);
- return this.inbuffer.fillBuffer();
+ return this.inBuffer.fillBuffer();
} 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/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
index 374da33..44c614a 100644
--- a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
+++ b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
@@ -65,7 +65,7 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
/**
* Creates new instance of DefaultBHttpClientConnection.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
@@ -83,7 +83,7 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
* {@link DefaultHttpResponseParserFactory#INSTANCE} will be used.
*/
public DefaultBHttpClientConnection(
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
@@ -92,7 +92,7 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
- super(buffersize, fragmentSizeHint, chardecoder, charencoder,
+ super(bufferSize, fragmentSizeHint, chardecoder, charencoder,
constraints, incomingContentStrategy, outgoingContentStrategy);
this.requestWriter = (requestWriterFactory != null ? requestWriterFactory :
DefaultHttpRequestWriterFactory.INSTANCE).create(getSessionOutputBuffer());
@@ -101,15 +101,15 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
}
public DefaultBHttpClientConnection(
- final int buffersize,
+ final int bufferSize,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final MessageConstraints constraints) {
- this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
+ this(bufferSize, bufferSize, chardecoder, charencoder, constraints, null, null, null, null);
}
- public DefaultBHttpClientConnection(final int buffersize) {
- this(buffersize, buffersize, null, null, null, null, null, null, null);
+ public DefaultBHttpClientConnection(final int bufferSize) {
+ this(bufferSize, bufferSize, null, null, null, null, null, null, null);
}
protected void onResponseReceived(final HttpResponse response) {
@@ -152,9 +152,9 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
if (entity == null) {
return;
}
- final OutputStream outstream = prepareOutput(request);
- entity.writeTo(outstream);
- outstream.close();
+ final OutputStream outStream = prepareOutput(request);
+ entity.writeTo(outStream);
+ outStream.close();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
index 85b46b7..5e9f65d 100644
--- a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
+++ b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
@@ -63,7 +63,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
/**
* Creates new instance of DefaultBHttpServerConnection.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
@@ -81,7 +81,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
* {@link DefaultHttpResponseWriterFactory#INSTANCE} will be used.
*/
public DefaultBHttpServerConnection(
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
@@ -90,7 +90,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageParserFactory<HttpRequest> requestParserFactory,
final HttpMessageWriterFactory<HttpResponse> responseWriterFactory) {
- super(buffersize, fragmentSizeHint, chardecoder, charencoder, constraints,
+ super(bufferSize, fragmentSizeHint, chardecoder, charencoder, constraints,
incomingContentStrategy != null ? incomingContentStrategy :
DisallowIdentityContentLengthStrategy.INSTANCE, outgoingContentStrategy);
this.requestParser = (requestParserFactory != null ? requestParserFactory :
@@ -100,15 +100,15 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
}
public DefaultBHttpServerConnection(
- final int buffersize,
+ final int bufferSize,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final MessageConstraints constraints) {
- this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
+ this(bufferSize, bufferSize, chardecoder, charencoder, constraints, null, null, null, null);
}
- public DefaultBHttpServerConnection(final int buffersize) {
- this(buffersize, buffersize, null, null, null, null, null, null, null);
+ public DefaultBHttpServerConnection(final int bufferSize) {
+ this(bufferSize, bufferSize, null, null, null, null, null, null, null);
}
protected void onRequestReceived(final HttpRequest request) {
@@ -162,9 +162,9 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
if (entity == null) {
return;
}
- final OutputStream outstream = prepareOutput(response);
- entity.writeTo(outstream);
- outstream.close();
+ final OutputStream outStream = prepareOutput(response);
+ entity.writeTo(outStream);
+ outStream.close();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java b/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
index 9dc9c92..72a7878 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
@@ -119,7 +119,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 maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
* IOException will be thrown. Setting this parameter to a negative value
@@ -135,12 +135,12 @@ 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 int maxHeaderCount,
final int maxLineLen,
final LineParser parser) throws HttpException, IOException {
final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>();
- return parseHeaders(inbuffer, maxHeaderCount, maxLineLen,
+ return parseHeaders(inBuffer, maxHeaderCount, maxLineLen,
parser != null ? parser : BasicLineParser.INSTANCE,
headerLines);
}
@@ -149,7 +149,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 maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
* IOException will be thrown. Setting this parameter to a negative value
@@ -170,12 +170,12 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* @since 4.1
*/
public static Header[] parseHeaders(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
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(parser, "Line parser");
Args.notNull(headerLines, "Header line list");
@@ -187,8 +187,8 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
} else {
current.clear();
}
- final int l = inbuffer.readLine(current);
- if (l == -1 || current.length() < 1) {
+ final int readLen = inBuffer.readLine(current);
+ if (readLen == -1 || current.length() < 1) {
break;
}
// Parse the header name and value
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java b/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
index a87708a..f4f62fa 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
@@ -186,19 +186,18 @@ public class ChunkedInputStream extends InputStream {
return -1;
}
}
- final int bytesRead = in.read(b, off, (int) Math.min(len, chunkSize - pos));
- if (bytesRead != -1) {
- pos += bytesRead;
+ final int readLen = in.read(b, off, (int) Math.min(len, chunkSize - pos));
+ if (readLen != -1) {
+ pos += readLen;
if (pos >= chunkSize) {
state = CHUNK_CRLF;
}
- return bytesRead;
- } else {
- eof = true;
- throw new TruncatedChunkException("Truncated chunk "
- + "( expected size: " + chunkSize
- + "; actual size: " + pos + ")");
+ return readLen;
}
+ eof = true;
+ throw new TruncatedChunkException("Truncated chunk "
+ + "( expected size: " + chunkSize
+ + "; actual size: " + pos + ")");
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java b/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
index 716df8d..6bfbacd 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
@@ -173,16 +173,16 @@ public class ContentLengthInputStream extends InputStream {
if (pos + len > contentLength) {
chunk = (int) (contentLength - pos);
}
- final int count = this.in.read(b, off, chunk);
- if (count == -1 && pos < contentLength) {
+ final int readLen = this.in.read(b, off, chunk);
+ if (readLen == -1 && pos < contentLength) {
throw new ConnectionClosedException(
"Premature end of Content-Length delimited message body (expected: "
+ contentLength + "; received: " + pos + ")");
}
- if (count > 0) {
- pos += count;
+ if (readLen > 0) {
+ pos += readLen;
}
- return count;
+ return readLen;
}
@@ -218,12 +218,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/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java b/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java
index 11ae414..56a1e3f 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpRequestParser.java
@@ -126,8 +126,8 @@ public class DefaultHttpRequestParser extends AbstractMessageParser<HttpRequest>
throws IOException, HttpException, ParseException {
this.lineBuf.clear();
- final int i = sessionBuffer.readLine(this.lineBuf);
- if (i == -1) {
+ final int readLen = sessionBuffer.readLine(this.lineBuf);
+ if (readLen == -1) {
throw new ConnectionClosedException("Client closed connection");
}
final ParserCursor cursor = new ParserCursor(0, this.lineBuf.length());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java b/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java
index 5467b40..d1a9787 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/DefaultHttpResponseParser.java
@@ -126,8 +126,8 @@ public class DefaultHttpResponseParser extends AbstractMessageParser<HttpRespons
throws IOException, HttpException, ParseException {
this.lineBuf.clear();
- final int i = sessionBuffer.readLine(this.lineBuf);
- if (i == -1) {
+ final int readLen = sessionBuffer.readLine(this.lineBuf);
+ if (readLen == -1) {
throw new NoHttpResponseException("The target server failed to respond");
}
//create the status line from the status string
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9dc8fe89/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java b/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
index a5c20e7..b6d3479 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
@@ -66,9 +66,8 @@ public class IdentityInputStream extends InputStream {
public int available() throws IOException {
if (this.in instanceof BufferInfo) {
return ((BufferInfo) this.in).length();
- } else {
- return 0;
}
+ return 0;
}
@Override
@@ -78,20 +77,12 @@ public class IdentityInputStream extends InputStream {
@Override
public int read() throws IOException {
- if (this.closed) {
- return -1;
- } else {
- return this.in.read();
- }
+ return this.closed ? -1 : this.in.read();
}
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
- if (this.closed) {
- return -1;
- } else {
- return this.in.read(b, off, len);
- }
+ return this.closed ? -1 : this.in.read(b, off, len);
}
}