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 18:50:40 UTC
[1/4] httpcomponents-core git commit: - Always use blocks - Add
missing serial version ID (default 1L) - Camel-case names. - Don't nest in
else clause unnecessarily. - Remove declared exceptions that are not thrown
(but don't break BC.) [Forced Update!]
Repository: httpcomponents-core
Updated Branches:
refs/heads/4.4.x 01deeaba8 -> 07a4acf78 (forced update)
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/message/TokenParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/message/TokenParser.java b/httpcore/src/main/java/org/apache/http/message/TokenParser.java
index 884b7c0..31baacb 100644
--- a/httpcore/src/main/java/org/apache/http/message/TokenParser.java
+++ b/httpcore/src/main/java/org/apache/http/message/TokenParser.java
@@ -158,9 +158,8 @@ public class TokenParser {
final char current = buf.charAt(i);
if (!isWhitespace(current)) {
break;
- } else {
- pos++;
}
+ pos++;
}
cursor.updatePos(pos);
}
@@ -184,10 +183,9 @@ public class TokenParser {
final char current = buf.charAt(i);
if ((delimiters != null && delimiters.get(current)) || isWhitespace(current)) {
break;
- } else {
- pos++;
- dst.append(current);
}
+ pos++;
+ dst.append(current);
}
cursor.updatePos(pos);
}
@@ -212,10 +210,9 @@ public class TokenParser {
if ((delimiters != null && delimiters.get(current))
|| isWhitespace(current) || current == DQUOTE) {
break;
- } else {
- pos++;
- dst.append(current);
}
+ pos++;
+ dst.append(current);
}
cursor.updatePos(pos);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java b/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
index 18655ad..c27276f 100644
--- a/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
+++ b/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
@@ -84,9 +84,8 @@ public class BasicHttpParams extends AbstractHttpParams implements Serializable,
if (this.parameters.containsKey(name)) {
this.parameters.remove(name);
return true;
- } else {
- return false;
}
+ return false;
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
index b10c932..14c6290 100644
--- a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
@@ -210,9 +210,8 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
callback.cancelled();
}
return true;
- } else {
- return false;
}
+ return false;
}
@Override
@@ -235,7 +234,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
}
@Override
- public E get(final long timeout, final TimeUnit tunit) throws InterruptedException, ExecutionException, TimeoutException {
+ public E get(final long timeout, final TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
final E entry = entryRef.get();
if (entry != null) {
return entry;
@@ -243,7 +242,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
synchronized (this) {
try {
for (;;) {
- final E leasedEntry = getPoolEntryBlocking(route, state, timeout, tunit, this);
+ final E leasedEntry = getPoolEntryBlocking(route, state, timeout, timeUnit, this);
if (validateAfterInactivity > 0) {
if (leasedEntry.getUpdated() + validateAfterInactivity <= System.currentTimeMillis()) {
if (!validate(leasedEntry)) {
@@ -296,12 +295,12 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
private E getPoolEntryBlocking(
final T route, final Object state,
- final long timeout, final TimeUnit tunit,
+ final long timeout, final TimeUnit timeUnit,
final Future<E> future) throws IOException, InterruptedException, TimeoutException {
Date deadline = null;
if (timeout > 0) {
- deadline = new Date (System.currentTimeMillis() + tunit.toMillis(timeout));
+ deadline = new Date (System.currentTimeMillis() + timeUnit.toMillis(timeout));
}
this.lock.lock();
try {
@@ -432,11 +431,7 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
private int getMax(final T route) {
final Integer v = this.maxPerRoute.get(route);
- if (v != null) {
- return v.intValue();
- } else {
- return this.defaultMaxPerRoute;
- }
+ return v != null ? v.intValue() : this.defaultMaxPerRoute;
}
@Override
@@ -610,11 +605,11 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
* of time and evicts them from the pool.
*
* @param idletime maximum idle time.
- * @param tunit time unit.
+ * @param timeUnit time unit.
*/
- public void closeIdle(final long idletime, final TimeUnit tunit) {
- Args.notNull(tunit, "Time unit");
- long time = tunit.toMillis(idletime);
+ public void closeIdle(final long idletime, final TimeUnit timeUnit) {
+ Args.notNull(timeUnit, "Time unit");
+ long time = timeUnit.toMillis(idletime);
if (time < 0) {
time = 0;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java b/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
index dad5139..0459b2b 100644
--- a/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
+++ b/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
@@ -71,21 +71,21 @@ public abstract class PoolEntry<T, C> {
* @param conn the connection.
* @param timeToLive maximum time to live. May be zero if the connection
* does not have an expiry deadline.
- * @param tunit time unit.
+ * @param timeUnit time unit.
*/
public PoolEntry(final String id, final T route, final C conn,
- final long timeToLive, final TimeUnit tunit) {
+ final long timeToLive, final TimeUnit timeUnit) {
super();
Args.notNull(route, "Route");
Args.notNull(conn, "Connection");
- Args.notNull(tunit, "Time unit");
+ Args.notNull(timeUnit, "Time unit");
this.id = id;
this.route = route;
this.conn = conn;
this.created = System.currentTimeMillis();
this.updated = this.created;
if (timeToLive > 0) {
- final long deadline = this.created + tunit.toMillis(timeToLive);
+ final long deadline = this.created + timeUnit.toMillis(timeToLive);
// If the above overflows then default to Long.MAX_VALUE
this.validityDeadline = deadline > 0 ? deadline : Long.MAX_VALUE;
} else {
@@ -152,12 +152,12 @@ public abstract class PoolEntry<T, C> {
return this.expiry;
}
- public synchronized void updateExpiry(final long time, final TimeUnit tunit) {
- Args.notNull(tunit, "Time unit");
+ public synchronized void updateExpiry(final long time, final TimeUnit timeUnit) {
+ Args.notNull(timeUnit, "Time unit");
this.updated = System.currentTimeMillis();
final long newExpiry;
if (time > 0) {
- newExpiry = this.updated + tunit.toMillis(time);
+ newExpiry = this.updated + timeUnit.toMillis(time);
} else {
newExpiry = Long.MAX_VALUE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java b/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
index c337228..5280ba9 100644
--- a/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/RouteSpecificPool.java
@@ -99,11 +99,7 @@ abstract class RouteSpecificPool<T, C, E extends PoolEntry<T, C>> {
}
public E getLastUsed() {
- if (!this.available.isEmpty()) {
- return this.available.getLast();
- } else {
- return null;
- }
+ return this.available.isEmpty() ? null : this.available.getLast();
}
public boolean remove(final E entry) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java b/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
index f690a04..481ce2f 100644
--- a/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
+++ b/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
@@ -78,11 +78,9 @@ public class HttpCoreContext implements HttpContext {
public static HttpCoreContext adapt(final HttpContext context) {
Args.notNull(context, "HTTP context");
- if (context instanceof HttpCoreContext) {
- return (HttpCoreContext) context;
- } else {
- return new HttpCoreContext(context);
- }
+ return context instanceof HttpCoreContext
+ ? (HttpCoreContext) context
+ : new HttpCoreContext(context);
}
private final HttpContext context;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java b/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
index 25d6695..93a2efd 100644
--- a/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
+++ b/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
@@ -165,11 +165,10 @@ public class UriPatternMatcher<T> {
protected boolean matchUriRequestPattern(final String pattern, final String path) {
if (pattern.equals("*")) {
return true;
- } else {
- return
- (pattern.endsWith("*") && path.startsWith(pattern.substring(0, pattern.length() - 1))) ||
- (pattern.startsWith("*") && path.endsWith(pattern.substring(1, pattern.length())));
}
+ return
+ (pattern.endsWith("*") && path.startsWith(pattern.substring(0, pattern.length() - 1))) ||
+ (pattern.startsWith("*") && path.endsWith(pattern.substring(1, pattern.length())));
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/util/LangUtils.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/LangUtils.java b/httpcore/src/main/java/org/apache/http/util/LangUtils.java
index 44e497a..2d37a28 100644
--- a/httpcore/src/main/java/org/apache/http/util/LangUtils.java
+++ b/httpcore/src/main/java/org/apache/http/util/LangUtils.java
@@ -83,18 +83,16 @@ public final class LangUtils {
public static boolean equals(final Object[] a1, final Object[] a2) {
if (a1 == null) {
return a2 == null;
- } else {
- if (a2 != null && a1.length == a2.length) {
- for (int i = 0; i < a1.length; i++) {
- if (!equals(a1[i], a2[i])) {
- return false;
- }
+ }
+ if (a2 != null && a1.length == a2.length) {
+ for (int i = 0; i < a1.length; i++) {
+ if (!equals(a1[i], a2[i])) {
+ return false;
}
- return true;
- } else {
- return false;
}
+ return true;
}
+ return false;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/impl/SessionOutputBufferMock.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/impl/SessionOutputBufferMock.java b/httpcore/src/test/java/org/apache/http/impl/SessionOutputBufferMock.java
index 421d849..aa9e204 100644
--- a/httpcore/src/test/java/org/apache/http/impl/SessionOutputBufferMock.java
+++ b/httpcore/src/test/java/org/apache/http/impl/SessionOutputBufferMock.java
@@ -80,11 +80,7 @@ public class SessionOutputBufferMock extends SessionOutputBufferImpl {
}
public byte[] getData() {
- if (this.buffer != null) {
- return this.buffer.toByteArray();
- } else {
- return new byte[] {};
- }
+ return this.buffer != null ? this.buffer.toByteArray() : new byte[] {};
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/impl/io/TimeoutByteArrayInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/impl/io/TimeoutByteArrayInputStream.java b/httpcore/src/test/java/org/apache/http/impl/io/TimeoutByteArrayInputStream.java
index dabc617..5a57e3a 100644
--- a/httpcore/src/test/java/org/apache/http/impl/io/TimeoutByteArrayInputStream.java
+++ b/httpcore/src/test/java/org/apache/http/impl/io/TimeoutByteArrayInputStream.java
@@ -61,9 +61,8 @@ class TimeoutByteArrayInputStream extends InputStream {
final int v = this.buf[this.pos++] & 0xff;
if (v != 0) {
return v;
- } else {
- throw new InterruptedIOException("Timeout");
}
+ throw new InterruptedIOException("Timeout");
}
@Override
@@ -92,10 +91,9 @@ class TimeoutByteArrayInputStream extends InputStream {
final int v = this.buf[this.pos] & 0xff;
if (v == 0) {
return i;
- } else {
- b[off + i] = (byte) v;
- this.pos++;
}
+ b[off + i] = (byte) v;
+ this.pos++;
}
return chunk;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java b/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
index e5417a3..164c4e4 100644
--- a/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
+++ b/httpcore/src/test/java/org/apache/http/pool/TestConnPool.java
@@ -187,16 +187,16 @@ public class TestConnPool {
private final Future<LocalPoolEntry> future;
private final long time;
- private final TimeUnit tunit;
+ private final TimeUnit timeUnit;
private volatile LocalPoolEntry entry;
private volatile Exception ex;
- GetPoolEntryThread(final Future<LocalPoolEntry> future, final long time, final TimeUnit tunit) {
+ GetPoolEntryThread(final Future<LocalPoolEntry> future, final long time, final TimeUnit timeUnit) {
super();
this.future = future;
this.time = time;
- this.tunit = tunit;
+ this.timeUnit = timeUnit;
setDaemon(true);
}
@@ -207,7 +207,7 @@ public class TestConnPool {
@Override
public void run() {
try {
- this.entry = this.future.get(this.time, this.tunit);
+ this.entry = this.future.get(this.time, this.timeUnit);
} catch (final Exception ex) {
this.ex = ex;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java b/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
index 6bad38e..52ccd50 100644
--- a/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
+++ b/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
@@ -39,13 +39,13 @@ public class TestPoolEntry {
static class MockPoolEntry extends PoolEntry<String, HttpConnection> {
public MockPoolEntry(final String route,
- final long timeToLive, final TimeUnit tunit) {
- super(null, route, Mockito.mock(HttpConnection.class), timeToLive, tunit);
+ final long timeToLive, final TimeUnit timeUnit) {
+ super(null, route, Mockito.mock(HttpConnection.class), timeToLive, timeUnit);
}
public MockPoolEntry(final String route, final HttpConnection conn,
- final long timeToLive, final TimeUnit tunit) {
- super(null, route, conn, timeToLive, tunit);
+ final long timeToLive, final TimeUnit timeUnit) {
+ super(null, route, conn, timeToLive, timeUnit);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
index e937716..7f3d544 100644
--- a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
+++ b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
@@ -559,11 +559,7 @@ public class TestSSLContextBuilder {
final PrivateKeyStrategy privateKeyStrategy = new PrivateKeyStrategy() {
@Override
public String chooseAlias(final Map<String, PrivateKeyDetails> aliases, final Socket socket) {
- if (aliases.keySet().contains("client2")) {
- return "client2";
- } else {
- return null;
- }
+ return aliases.keySet().contains("client2") ? "client2" : null;
}
};
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/testserver/HttpServer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/testserver/HttpServer.java b/httpcore/src/test/java/org/apache/http/testserver/HttpServer.java
index 21224a3..64af7e5 100644
--- a/httpcore/src/test/java/org/apache/http/testserver/HttpServer.java
+++ b/httpcore/src/test/java/org/apache/http/testserver/HttpServer.java
@@ -53,7 +53,7 @@ public class HttpServer {
private volatile org.apache.http.impl.bootstrap.HttpServer server;
- public HttpServer() throws IOException {
+ public HttpServer() {
super();
this.reqistry = new UriHttpRequestHandlerMapper();
}
@@ -80,18 +80,16 @@ public class HttpServer {
final org.apache.http.impl.bootstrap.HttpServer local = this.server;
if (local != null) {
return this.server.getLocalPort();
- } else {
- throw new IllegalStateException("Server not running");
}
+ throw new IllegalStateException("Server not running");
}
public InetAddress getInetAddress() {
final org.apache.http.impl.bootstrap.HttpServer local = this.server;
if (local != null) {
return local.getInetAddress();
- } else {
- throw new IllegalStateException("Server not running");
}
+ throw new IllegalStateException("Server not running");
}
public void start() throws IOException {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpClientConnection.java b/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpClientConnection.java
index a623a10..afecfc7 100644
--- a/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpClientConnection.java
+++ b/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpClientConnection.java
@@ -52,25 +52,25 @@ public class LoggingBHttpClientConnection extends DefaultBHttpClientConnection {
private final String id;
private final Log log;
- private final Log headerlog;
+ private final Log headerLog;
private final Wire wire;
public LoggingBHttpClientConnection(
final int bufferSize,
final int fragmentSizeHint,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
- super(bufferSize, fragmentSizeHint, chardecoder, charencoder,
+ super(bufferSize, fragmentSizeHint, charDecoder, charEncoder,
constraints, incomingContentStrategy, outgoingContentStrategy,
requestWriterFactory, responseParserFactory);
this.id = "http-outgoing-" + COUNT.incrementAndGet();
this.log = LogFactory.getLog(getClass());
- this.headerlog = LogFactory.getLog("org.apache.http.headers");
+ this.headerLog = LogFactory.getLog("org.apache.http.headers");
this.wire = new Wire(LogFactory.getLog("org.apache.http.wire"), this.id);
}
@@ -114,22 +114,22 @@ public class LoggingBHttpClientConnection extends DefaultBHttpClientConnection {
@Override
protected void onResponseReceived(final HttpResponse response) {
- if (response != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+ if (response != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(this.id + " << " + response.getStatusLine().toString());
final Header[] headers = response.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " << " + header.toString());
+ this.headerLog.debug(this.id + " << " + header.toString());
}
}
}
@Override
protected void onRequestSubmitted(final HttpRequest request) {
- if (request != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(id + " >> " + request.getRequestLine().toString());
+ if (request != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(id + " >> " + request.getRequestLine().toString());
final Header[] headers = request.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " >> " + header.toString());
+ this.headerLog.debug(this.id + " >> " + header.toString());
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpServerConnection.java b/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpServerConnection.java
index 030a25f..b81150d 100644
--- a/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpServerConnection.java
+++ b/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpServerConnection.java
@@ -52,25 +52,25 @@ public class LoggingBHttpServerConnection extends DefaultBHttpServerConnection {
private final String id;
private final Log log;
- private final Log headerlog;
+ private final Log headerLog;
private final Wire wire;
public LoggingBHttpServerConnection(
final int bufferSize,
final int fragmentSizeHint,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageParserFactory<HttpRequest> requestParserFactory,
final HttpMessageWriterFactory<HttpResponse> responseWriterFactory) {
- super(bufferSize, fragmentSizeHint, chardecoder, charencoder, constraints,
+ super(bufferSize, fragmentSizeHint, charDecoder, charEncoder, constraints,
incomingContentStrategy, outgoingContentStrategy,
requestParserFactory, responseWriterFactory);
this.id = "http-incoming-" + COUNT.incrementAndGet();
this.log = LogFactory.getLog(getClass());
- this.headerlog = LogFactory.getLog("org.apache.http.headers");
+ this.headerLog = LogFactory.getLog("org.apache.http.headers");
this.wire = new Wire(LogFactory.getLog("org.apache.http.wire"), this.id);
}
@@ -114,22 +114,22 @@ public class LoggingBHttpServerConnection extends DefaultBHttpServerConnection {
@Override
protected void onRequestReceived(final HttpRequest request) {
- if (request != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(this.id + " >> " + request.getRequestLine().toString());
+ if (request != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(this.id + " >> " + request.getRequestLine().toString());
final Header[] headers = request.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " >> " + header.toString());
+ this.headerLog.debug(this.id + " >> " + header.toString());
}
}
}
@Override
protected void onResponseSubmitted(final HttpResponse response) {
- if (response != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+ if (response != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(this.id + " << " + response.getStatusLine().toString());
final Header[] headers = response.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " << " + header.toString());
+ this.headerLog.debug(this.id + " << " + header.toString());
}
}
}
[2/4] httpcomponents-core git commit: - Always use blocks - Add
missing serial version ID (default 1L) - Camel-case names. - Don't nest in
else clause unnecessarily. - Remove declared exceptions that are not thrown
(but don't break BC.)
Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
index d1b1953..9672db6 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
@@ -103,15 +103,15 @@ public class TestNIOConnPool {
static class LocalSessionPool extends AbstractNIOConnPool<String, IOSession, LocalPoolEntry> {
public LocalSessionPool(
- final ConnectingIOReactor ioreactor, final int defaultMaxPerRoute, final int maxTotal) {
- super(ioreactor, new LocalConnFactory(), new LocalAddressResolver(), defaultMaxPerRoute, maxTotal);
+ final ConnectingIOReactor ioReactor, final int defaultMaxPerRoute, final int maxTotal) {
+ super(ioReactor, new LocalConnFactory(), new LocalAddressResolver(), defaultMaxPerRoute, maxTotal);
}
public LocalSessionPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final SocketAddressResolver<String> addressResolver,
final int defaultMaxPerRoute, final int maxTotal) {
- super(ioreactor, new LocalConnFactory(), addressResolver, defaultMaxPerRoute, maxTotal);
+ super(ioReactor, new LocalConnFactory(), addressResolver, defaultMaxPerRoute, maxTotal);
}
@Override
@@ -123,8 +123,8 @@ public class TestNIOConnPool {
@Test
public void testEmptyPool() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final PoolStats totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
Assert.assertEquals(0, totals.getLeased());
@@ -149,19 +149,19 @@ public class TestNIOConnPool {
@Test
public void testInvalidConstruction() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
try {
new LocalSessionPool(null, 1, 1);
Assert.fail("IllegalArgumentException should have been thrown");
} catch (final IllegalArgumentException expected) {
}
try {
- new LocalSessionPool(ioreactor, -1, 1);
+ new LocalSessionPool(ioReactor, -1, 1);
Assert.fail("IllegalArgumentException should have been thrown");
} catch (final IllegalArgumentException expected) {
}
try {
- new LocalSessionPool(ioreactor, 1, -1);
+ new LocalSessionPool(ioReactor, 1, -1);
Assert.fail("IllegalArgumentException should have been thrown");
} catch (final IllegalArgumentException expected) {
}
@@ -169,17 +169,17 @@ public class TestNIOConnPool {
@Test
public void testSuccessfulConnect() throws Exception {
- final IOSession iosession = Mockito.mock(IOSession.class);
+ final IOSession ioSession = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ Mockito.when(sessionRequest.getSession()).thenReturn(ioSession);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null, 100, TimeUnit.MILLISECONDS, null);
Mockito.verify(sessionRequest).setConnectTimeout(100);
@@ -206,13 +206,13 @@ public class TestNIOConnPool {
final SessionRequest sessionRequest = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest.getAttachment()).thenReturn("somehost");
Mockito.when(sessionRequest.getException()).thenReturn(new IOException());
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
PoolStats totals = pool.getTotalStats();
@@ -239,18 +239,18 @@ public class TestNIOConnPool {
@Test
public void testCencelledConnect() throws Exception {
- final IOSession iosession = Mockito.mock(IOSession.class);
+ final IOSession ioSession = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ Mockito.when(sessionRequest.getSession()).thenReturn(ioSession);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
- Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
PoolStats totals = pool.getTotalStats();
@@ -276,19 +276,19 @@ public class TestNIOConnPool {
@Test
public void testTimeoutConnect() throws Exception {
- final IOSession iosession = Mockito.mock(IOSession.class);
+ final IOSession ioSession = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest.getAttachment()).thenReturn("somehost");
Mockito.when(sessionRequest.getRemoteAddress())
.thenReturn(new InetSocketAddress(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}), 80));
- Mockito.when(sessionRequest.getSession()).thenReturn(iosession);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ Mockito.when(sessionRequest.getSession()).thenReturn(ioSession);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
PoolStats totals = pool.getTotalStats();
@@ -319,10 +319,10 @@ public class TestNIOConnPool {
final SessionRequest sessionRequest = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest.getAttachment()).thenReturn("somehost");
Mockito.when(sessionRequest.getException()).thenReturn(new IOException());
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
final SocketAddressResolver<String> addressResolver = Mockito.mock(SocketAddressResolver.class);
Mockito.when(addressResolver.resolveRemoteAddress("somehost")).thenThrow(new UnknownHostException());
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, addressResolver, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, addressResolver, 2, 10);
final Future<LocalPoolEntry> future = pool.lease("somehost", null);
Assert.assertTrue(future.isDone());
@@ -337,29 +337,29 @@ public class TestNIOConnPool {
@Test
public void testLeaseRelease() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final IOSession iosession2 = Mockito.mock(IOSession.class);
+ final IOSession ioSession2 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest2 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest2.getAttachment()).thenReturn("otherhost");
- Mockito.when(sessionRequest2.getSession()).thenReturn(iosession2);
+ Mockito.when(sessionRequest2.getSession()).thenReturn(ioSession2);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
- Mockito.when(ioreactor.connect(
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
pool.requestCompleted(sessionRequest1);
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
@@ -377,8 +377,8 @@ public class TestNIOConnPool {
pool.release(entry1, true);
pool.release(entry2, true);
pool.release(entry3, false);
- Mockito.verify(iosession1, Mockito.never()).close();
- Mockito.verify(iosession2, Mockito.times(1)).close();
+ Mockito.verify(ioSession1, Mockito.never()).close();
+ Mockito.verify(ioSession2, Mockito.times(1)).close();
final PoolStats totals = pool.getTotalStats();
Assert.assertEquals(2, totals.getAvailable());
@@ -388,8 +388,8 @@ public class TestNIOConnPool {
@Test
public void testLeaseIllegal() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
try {
pool.lease(null, null, 0, TimeUnit.MILLISECONDS, null);
Assert.fail("IllegalArgumentException should have been thrown");
@@ -404,36 +404,36 @@ public class TestNIOConnPool {
@Test
public void testReleaseUnknownEntry() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
pool.release(new LocalPoolEntry("somehost", Mockito.mock(IOSession.class)), true);
}
@Test
public void testMaxLimits() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final IOSession iosession2 = Mockito.mock(IOSession.class);
+ final IOSession ioSession2 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest2 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest2.getAttachment()).thenReturn("otherhost");
- Mockito.when(sessionRequest2.getSession()).thenReturn(iosession2);
+ Mockito.when(sessionRequest2.getSession()).thenReturn(ioSession2);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
- Mockito.when(ioreactor.connect(
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest2);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
pool.setMaxPerRoute("somehost", 2);
pool.setMaxPerRoute("otherhost", 1);
pool.setMaxTotal(3);
@@ -481,7 +481,7 @@ public class TestNIOConnPool {
Assert.assertFalse(future8.isDone());
Assert.assertFalse(future9.isDone());
- Mockito.verify(ioreactor, Mockito.times(3)).connect(
+ Mockito.verify(ioReactor, Mockito.times(3)).connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -493,46 +493,46 @@ public class TestNIOConnPool {
Assert.assertFalse(future8.isDone());
Assert.assertTrue(future9.isDone());
- Mockito.verify(ioreactor, Mockito.times(4)).connect(
+ Mockito.verify(ioReactor, Mockito.times(4)).connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
}
@Test
public void testConnectionRedistributionOnTotalMaxLimit() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final IOSession iosession2 = Mockito.mock(IOSession.class);
+ final IOSession ioSession2 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest2 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest2.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest2.getSession()).thenReturn(iosession2);
+ Mockito.when(sessionRequest2.getSession()).thenReturn(ioSession2);
- final IOSession iosession3 = Mockito.mock(IOSession.class);
+ final IOSession ioSession3 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest3 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest3.getAttachment()).thenReturn("otherhost");
- Mockito.when(sessionRequest3.getSession()).thenReturn(iosession3);
+ Mockito.when(sessionRequest3.getSession()).thenReturn(ioSession3);
- final IOSession iosession4 = Mockito.mock(IOSession.class);
+ final IOSession ioSession4 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest4 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest4.getAttachment()).thenReturn("otherhost");
- Mockito.when(sessionRequest4.getSession()).thenReturn(iosession4);
+ Mockito.when(sessionRequest4.getSession()).thenReturn(ioSession4);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest1);
- Mockito.when(ioreactor.connect(
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest3, sessionRequest4, sessionRequest3);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
pool.setMaxPerRoute("somehost", 2);
pool.setMaxPerRoute("otherhost", 2);
pool.setMaxTotal(2);
@@ -542,12 +542,12 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future3 = pool.lease("otherhost", null);
final Future<LocalPoolEntry> future4 = pool.lease("otherhost", null);
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
- Mockito.verify(ioreactor, Mockito.never()).connect(
+ Mockito.verify(ioReactor, Mockito.never()).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -573,12 +573,12 @@ public class TestNIOConnPool {
pool.release(entry1, true);
pool.release(entry2, true);
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -601,12 +601,12 @@ public class TestNIOConnPool {
final Future<LocalPoolEntry> future5 = pool.lease("somehost", null);
final Future<LocalPoolEntry> future6 = pool.lease("otherhost", null);
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -614,12 +614,12 @@ public class TestNIOConnPool {
pool.release(entry3, true);
pool.release(entry4, true);
- Mockito.verify(ioreactor, Mockito.times(3)).connect(
+ Mockito.verify(ioReactor, Mockito.times(3)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -641,12 +641,12 @@ public class TestNIOConnPool {
pool.release(entry5, true);
pool.release(entry6, true);
- Mockito.verify(ioreactor, Mockito.times(3)).connect(
+ Mockito.verify(ioReactor, Mockito.times(3)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -659,36 +659,36 @@ public class TestNIOConnPool {
@Test
public void testStatefulConnectionRedistributionOnPerRouteMaxLimit() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final IOSession iosession2 = Mockito.mock(IOSession.class);
+ final IOSession ioSession2 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest2 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest2.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest2.getSession()).thenReturn(iosession2);
+ Mockito.when(sessionRequest2.getSession()).thenReturn(ioSession2);
- final IOSession iosession3 = Mockito.mock(IOSession.class);
+ final IOSession ioSession3 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest3 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest3.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest3.getSession()).thenReturn(iosession3);
+ Mockito.when(sessionRequest3.getSession()).thenReturn(ioSession3);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2, sessionRequest3);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 10);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 10);
pool.setMaxPerRoute("somehost", 2);
pool.setMaxTotal(2);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -723,7 +723,7 @@ public class TestNIOConnPool {
final LocalPoolEntry entry4 = future4.get();
Assert.assertNotNull(entry4);
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -740,13 +740,13 @@ public class TestNIOConnPool {
Assert.assertFalse(future5.isDone());
- Mockito.verify(ioreactor, Mockito.times(3)).connect(
+ Mockito.verify(ioReactor, Mockito.times(3)).connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
- Mockito.verify(iosession2).close();
- Mockito.verify(iosession1, Mockito.never()).close();
+ Mockito.verify(ioSession2).close();
+ Mockito.verify(ioSession1, Mockito.never()).close();
totals = pool.getTotalStats();
Assert.assertEquals(1, totals.getAvailable());
@@ -756,24 +756,24 @@ public class TestNIOConnPool {
@Test
public void testCreateNewIfExpired() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
- Mockito.when(iosession1.isClosed()).thenReturn(Boolean.TRUE);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
+ Mockito.when(ioSession1.isClosed()).thenReturn(Boolean.TRUE);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
- Mockito.verify(ioreactor, Mockito.times(1)).connect(
+ Mockito.verify(ioReactor, Mockito.times(1)).connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -792,8 +792,8 @@ public class TestNIOConnPool {
Assert.assertFalse(future2.isDone());
- Mockito.verify(iosession1).close();
- Mockito.verify(ioreactor, Mockito.times(2)).connect(
+ Mockito.verify(ioSession1).close();
+ Mockito.verify(ioReactor, Mockito.times(2)).connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class));
@@ -810,24 +810,24 @@ public class TestNIOConnPool {
@Test
public void testCloseExpired() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
- Mockito.when(iosession1.isClosed()).thenReturn(Boolean.TRUE);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
+ Mockito.when(ioSession1.isClosed()).thenReturn(Boolean.TRUE);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final IOSession iosession2 = Mockito.mock(IOSession.class);
+ final IOSession ioSession2 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest2 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest2.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest2.getSession()).thenReturn(iosession2);
+ Mockito.when(sessionRequest2.getSession()).thenReturn(ioSession2);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
@@ -852,8 +852,8 @@ public class TestNIOConnPool {
pool.closeExpired();
- Mockito.verify(iosession1).close();
- Mockito.verify(iosession2, Mockito.never()).close();
+ Mockito.verify(ioSession1).close();
+ Mockito.verify(ioSession2, Mockito.never()).close();
final PoolStats totals = pool.getTotalStats();
Assert.assertEquals(1, totals.getAvailable());
@@ -867,23 +867,23 @@ public class TestNIOConnPool {
@Test
public void testCloseIdle() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final IOSession iosession2 = Mockito.mock(IOSession.class);
+ final IOSession ioSession2 = Mockito.mock(IOSession.class);
final SessionRequest sessionRequest2 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest2.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest2.getSession()).thenReturn(iosession2);
+ Mockito.when(sessionRequest2.getSession()).thenReturn(ioSession2);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1, sessionRequest2);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null);
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null);
@@ -908,8 +908,8 @@ public class TestNIOConnPool {
pool.closeIdle(50, TimeUnit.MILLISECONDS);
- Mockito.verify(iosession1).close();
- Mockito.verify(iosession2, Mockito.never()).close();
+ Mockito.verify(ioSession1).close();
+ Mockito.verify(ioSession2, Mockito.never()).close();
PoolStats totals = pool.getTotalStats();
Assert.assertEquals(1, totals.getAvailable());
@@ -922,7 +922,7 @@ public class TestNIOConnPool {
pool.closeIdle(-1, TimeUnit.MILLISECONDS);
- Mockito.verify(iosession2).close();
+ Mockito.verify(ioSession2).close();
totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
@@ -936,19 +936,19 @@ public class TestNIOConnPool {
@Test
public void testLeaseRequestTimeout() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
- Mockito.when(iosession1.isClosed()).thenReturn(Boolean.TRUE);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
+ Mockito.when(ioSession1.isClosed()).thenReturn(Boolean.TRUE);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 1, 1);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 1, 1);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null, 0, TimeUnit.MILLISECONDS, null);
final Future<LocalPoolEntry> future2 = pool.lease("somehost", null, 0, TimeUnit.MILLISECONDS, null);
@@ -972,22 +972,22 @@ public class TestNIOConnPool {
@Test(expected=IllegalArgumentException.class)
public void testCloseIdleInvalid() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
pool.closeIdle(50, null);
}
@Test(expected=IllegalArgumentException.class)
public void testGetStatsInvalid() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
pool.getStats(null);
}
@Test
public void testSetMaxInvalid() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
try {
pool.setMaxTotal(-1);
Assert.fail("IllegalArgumentException should have been thrown");
@@ -1007,8 +1007,8 @@ public class TestNIOConnPool {
@Test
public void testSetMaxPerRoute() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
pool.setMaxPerRoute("somehost", 1);
Assert.assertEquals(1, pool.getMaxPerRoute("somehost"));
pool.setMaxPerRoute("somehost", 0);
@@ -1019,12 +1019,12 @@ public class TestNIOConnPool {
@Test
public void testShutdown() throws Exception {
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 2, 2);
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 2, 2);
pool.shutdown(1000);
- Mockito.verify(ioreactor, Mockito.times(1)).shutdown(1000);
+ Mockito.verify(ioReactor, Mockito.times(1)).shutdown(1000);
pool.shutdown(1000);
- Mockito.verify(ioreactor, Mockito.times(1)).shutdown(1000);
+ Mockito.verify(ioReactor, Mockito.times(1)).shutdown(1000);
try {
pool.lease("somehost", null);
Assert.fail("IllegalStateException should have been thrown");
@@ -1040,20 +1040,20 @@ public class TestNIOConnPool {
@Test
public void testLeaseRequestCanceled() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
- Mockito.when(iosession1.isClosed()).thenReturn(Boolean.TRUE);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
+ Mockito.when(ioSession1.isClosed()).thenReturn(Boolean.TRUE);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
- Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
+ Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 1, 1);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 1, 1);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null, 0, TimeUnit.MILLISECONDS, null);
future1.cancel(true);
@@ -1074,20 +1074,20 @@ public class TestNIOConnPool {
@Test
public void testLeaseRequestCanceledWhileConnecting() throws Exception {
- final IOSession iosession1 = Mockito.mock(IOSession.class);
- Mockito.when(iosession1.isClosed()).thenReturn(Boolean.TRUE);
+ final IOSession ioSession1 = Mockito.mock(IOSession.class);
+ Mockito.when(ioSession1.isClosed()).thenReturn(Boolean.TRUE);
final SessionRequest sessionRequest1 = Mockito.mock(SessionRequest.class);
Mockito.when(sessionRequest1.getAttachment()).thenReturn("somehost");
- Mockito.when(sessionRequest1.getSession()).thenReturn(iosession1);
+ Mockito.when(sessionRequest1.getSession()).thenReturn(ioSession1);
- final ConnectingIOReactor ioreactor = Mockito.mock(ConnectingIOReactor.class);
- Mockito.when(ioreactor.connect(
+ final ConnectingIOReactor ioReactor = Mockito.mock(ConnectingIOReactor.class);
+ Mockito.when(ioReactor.connect(
Matchers.any(SocketAddress.class), Matchers.any(SocketAddress.class),
Matchers.any(), Matchers.any(SessionRequestCallback.class))).
thenReturn(sessionRequest1);
- Mockito.when(ioreactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
+ Mockito.when(ioReactor.getStatus()).thenReturn(IOReactorStatus.ACTIVE);
- final LocalSessionPool pool = new LocalSessionPool(ioreactor, 1, 1);
+ final LocalSessionPool pool = new LocalSessionPool(ioReactor, 1, 1);
final Future<LocalPoolEntry> future1 = pool.lease("somehost", null, 0, TimeUnit.MILLISECONDS, null);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestConsumer.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestConsumer.java
index 2d2bd68..af496ae 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestConsumer.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestConsumer.java
@@ -50,7 +50,7 @@ public class TestBasicAsyncRequestConsumer {
@Mock private HttpEntityEnclosingRequest request;
@Mock private HttpContext context;
@Mock private ContentDecoder decoder;
- @Mock private IOControl ioctrl;
+ @Mock private IOControl ioControl;
@Before
public void setUp() throws Exception {
@@ -68,7 +68,7 @@ public class TestBasicAsyncRequestConsumer {
when(request.getEntity()).thenReturn(new StringEntity("stuff"));
consumer.requestReceived(request);
- consumer.consumeContent(decoder, ioctrl);
+ consumer.consumeContent(decoder, ioControl);
consumer.requestCompleted(context);
verify(consumer).releaseResources();
@@ -88,7 +88,7 @@ public class TestBasicAsyncRequestConsumer {
when(consumer.buildResult(context)).thenThrow(ooopsie);
consumer.requestReceived(request);
- consumer.consumeContent(decoder, ioctrl);
+ consumer.consumeContent(decoder, ioControl);
consumer.requestCompleted(context);
verify(consumer).releaseResources();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseConsumer.java b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseConsumer.java
index 959dd20..e52c4fa 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseConsumer.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncResponseConsumer.java
@@ -50,7 +50,7 @@ public class TestBasicAsyncResponseConsumer {
@Mock private HttpResponse response;
@Mock private HttpContext context;
@Mock private ContentDecoder decoder;
- @Mock private IOControl ioctrl;
+ @Mock private IOControl ioControl;
@Before
public void setUp() throws Exception {
@@ -68,7 +68,7 @@ public class TestBasicAsyncResponseConsumer {
when(response.getEntity()).thenReturn(new StringEntity("stuff"));
consumer.responseReceived(response);
- consumer.consumeContent(decoder, ioctrl);
+ consumer.consumeContent(decoder, ioControl);
consumer.responseCompleted(context);
verify(consumer).releaseResources();
@@ -88,7 +88,7 @@ public class TestBasicAsyncResponseConsumer {
when(consumer.buildResult(context)).thenThrow(ooopsie);
consumer.responseReceived(response);
- consumer.consumeContent(decoder, ioctrl);
+ consumer.consumeContent(decoder, ioControl);
consumer.responseCompleted(context);
verify(consumer).releaseResources();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
index 0042772..b6121b6 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
@@ -56,14 +56,14 @@ public class ClientConnectionFactory implements NHttpConnectionFactory<DefaultNH
}
@Override
- public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
+ public DefaultNHttpClientConnection createConnection(final IOSession ioSession) {
if (this.sslContext != null) {
- final SSLIOSession ssliosession = new SSLIOSession(
- iosession, SSLMode.CLIENT, this.sslContext, this.setupHandler);
- iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
- return new LoggingNHttpClientConnection(ssliosession);
+ final SSLIOSession sslioSession = new SSLIOSession(
+ ioSession, SSLMode.CLIENT, this.sslContext, this.setupHandler);
+ ioSession.setAttribute(SSLIOSession.SESSION_KEY, sslioSession);
+ return new LoggingNHttpClientConnection(sslioSession);
} else {
- return new LoggingNHttpClientConnection(iosession);
+ return new LoggingNHttpClientConnection(ioSession);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingIOSession.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingIOSession.java
index 4aa4c03..b898b7a 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingIOSession.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingIOSession.java
@@ -45,18 +45,18 @@ import org.apache.http.nio.reactor.SessionBufferStatus;
public class LoggingIOSession implements IOSession {
private final Log log;
- private final Wire wirelog;
+ private final Wire wireLog;
private final String id;
private final IOSession session;
private final ByteChannel channel;
- public LoggingIOSession(final IOSession session, final String id, final Log log, final Log wirelog) {
+ public LoggingIOSession(final IOSession session, final String id, final Log log, final Log wireLog) {
super();
this.session = session;
this.channel = new LoggingByteChannel();
this.id = id;
this.log = log;
- this.wirelog = new Wire(wirelog, this.id);
+ this.wireLog = new Wire(wireLog, this.id);
}
@Override
@@ -210,12 +210,12 @@ public class LoggingIOSession implements IOSession {
if (log.isDebugEnabled()) {
log.debug(id + " " + session + ": " + bytesRead + " bytes read");
}
- if (bytesRead > 0 && wirelog.isEnabled()) {
+ if (bytesRead > 0 && wireLog.isEnabled()) {
final ByteBuffer b = dst.duplicate();
final int p = b.position();
b.limit(p);
b.position(p - bytesRead);
- wirelog.input(b);
+ wireLog.input(b);
}
return bytesRead;
}
@@ -226,12 +226,12 @@ public class LoggingIOSession implements IOSession {
if (log.isDebugEnabled()) {
log.debug(id + " " + session + ": " + byteWritten + " bytes written");
}
- if (byteWritten > 0 && wirelog.isEnabled()) {
+ if (byteWritten > 0 && wireLog.isEnabled()) {
final ByteBuffer b = src.duplicate();
final int p = b.position();
b.limit(p);
b.position(p - byteWritten);
- wirelog.output(b);
+ wireLog.output(b);
}
return byteWritten;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java
index 60dbb57..4428e29 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java
@@ -46,19 +46,19 @@ public class LoggingNHttpClientConnection extends DefaultNHttpClientConnection {
private final Log log;
private final Log iolog;
- private final Log headerlog;
- private final Log wirelog;
+ private final Log headerLog;
+ private final Log wireLog;
private final String id;
public LoggingNHttpClientConnection(final IOSession session) {
super(session, 8 * 1024);
this.log = LogFactory.getLog(getClass());
this.iolog = LogFactory.getLog(session.getClass());
- this.headerlog = LogFactory.getLog("org.apache.http.headers");
- this.wirelog = LogFactory.getLog("org.apache.http.wire");
+ this.headerLog = LogFactory.getLog("org.apache.http.headers");
+ this.wireLog = LogFactory.getLog("org.apache.http.wire");
this.id = "http-outgoing-" + COUNT.incrementAndGet();
- if (this.iolog.isDebugEnabled() || this.wirelog.isDebugEnabled()) {
- this.session = new LoggingIOSession(session, this.id, this.iolog, this.wirelog);
+ if (this.iolog.isDebugEnabled() || this.wireLog.isDebugEnabled()) {
+ this.session = new LoggingIOSession(session, this.id, this.iolog, this.wireLog);
}
}
@@ -104,22 +104,22 @@ public class LoggingNHttpClientConnection extends DefaultNHttpClientConnection {
@Override
protected void onResponseReceived(final HttpResponse response) {
- if (response != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+ if (response != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(this.id + " << " + response.getStatusLine().toString());
final Header[] headers = response.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " << " + header.toString());
+ this.headerLog.debug(this.id + " << " + header.toString());
}
}
}
@Override
protected void onRequestSubmitted(final HttpRequest request) {
- if (request != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(id + " >> " + request.getRequestLine().toString());
+ if (request != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(id + " >> " + request.getRequestLine().toString());
final Header[] headers = request.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " >> " + header.toString());
+ this.headerLog.debug(this.id + " >> " + header.toString());
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java
index 6004ef1..218dec8 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java
@@ -46,19 +46,19 @@ public class LoggingNHttpServerConnection extends DefaultNHttpServerConnection {
private final Log log;
private final Log iolog;
- private final Log headerlog;
- private final Log wirelog;
+ private final Log headerLog;
+ private final Log wireLog;
private final String id;
public LoggingNHttpServerConnection(final IOSession session) {
super(session, 8 * 1024);
this.log = LogFactory.getLog(getClass());
this.iolog = LogFactory.getLog(session.getClass());
- this.headerlog = LogFactory.getLog("org.apache.http.headers");
- this.wirelog = LogFactory.getLog("org.apache.http.wire");
+ this.headerLog = LogFactory.getLog("org.apache.http.headers");
+ this.wireLog = LogFactory.getLog("org.apache.http.wire");
this.id = "http-incoming-" + COUNT.incrementAndGet();
- if (this.iolog.isDebugEnabled() || this.wirelog.isDebugEnabled()) {
- this.session = new LoggingIOSession(session, this.id, this.iolog, this.wirelog);
+ if (this.iolog.isDebugEnabled() || this.wireLog.isDebugEnabled()) {
+ this.session = new LoggingIOSession(session, this.id, this.iolog, this.wireLog);
}
}
@@ -104,22 +104,22 @@ public class LoggingNHttpServerConnection extends DefaultNHttpServerConnection {
@Override
protected void onRequestReceived(final HttpRequest request) {
- if (request != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(this.id + " >> " + request.getRequestLine().toString());
+ if (request != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(this.id + " >> " + request.getRequestLine().toString());
final Header[] headers = request.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " >> " + header.toString());
+ this.headerLog.debug(this.id + " >> " + header.toString());
}
}
}
@Override
protected void onResponseSubmitted(final HttpResponse response) {
- if (response != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+ if (response != null && this.headerLog.isDebugEnabled()) {
+ this.headerLog.debug(this.id + " << " + response.getStatusLine().toString());
final Header[] headers = response.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(this.id + " << " + header.toString());
+ this.headerLog.debug(this.id + " << " + header.toString());
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
index 4c0b174..151212f 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
@@ -56,14 +56,14 @@ public class ServerConnectionFactory implements NHttpConnectionFactory<DefaultNH
}
@Override
- public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
+ public DefaultNHttpServerConnection createConnection(final IOSession ioSession) {
if (this.sslContext != null) {
- final SSLIOSession ssliosession = new SSLIOSession(
- iosession, SSLMode.SERVER, this.sslContext, this.setupHandler);
- iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
- return new LoggingNHttpServerConnection(ssliosession);
+ final SSLIOSession sslioSession = new SSLIOSession(
+ ioSession, SSLMode.SERVER, this.sslContext, this.setupHandler);
+ ioSession.setAttribute(SSLIOSession.SESSION_KEY, sslioSession);
+ return new LoggingNHttpServerConnection(sslioSession);
} else {
- return new LoggingNHttpServerConnection(iosession);
+ return new LoggingNHttpServerConnection(ioSession);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/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 dcf190c..fce3f53 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
@@ -207,9 +207,8 @@ public class SocketHttpServerConnection extends
} catch (final SocketException ignore) {
return -1;
}
- } else {
- return -1;
}
+ return -1;
}
@Override
@@ -272,9 +271,8 @@ public class SocketHttpServerConnection extends
formatAddress(buffer, remoteAddress);
}
return buffer.toString();
- } else {
- return super.toString();
}
+ return super.toString();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/HttpHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/HttpHost.java b/httpcore/src/main/java/org/apache/http/HttpHost.java
index cbd5ac0..50bad3c 100644
--- a/httpcore/src/main/java/org/apache/http/HttpHost.java
+++ b/httpcore/src/main/java/org/apache/http/HttpHost.java
@@ -287,9 +287,8 @@ public final class HttpHost implements Cloneable, Serializable {
buffer.append(":");
buffer.append(Integer.toString(this.port));
return buffer.toString();
- } else {
- return this.hostname;
}
+ return this.hostname;
}
@@ -310,9 +309,8 @@ public final class HttpHost implements Cloneable, Serializable {
&& this.port == that.port
&& this.schemeName.equals(that.schemeName)
&& (this.address==null ? that.address== null : this.address.equals(that.address));
- } else {
- return false;
}
+ return false;
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java b/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
index b8b2ca1..5402d4c 100644
--- a/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
+++ b/httpcore/src/main/java/org/apache/http/concurrent/BasicFuture.java
@@ -100,11 +100,10 @@ public class BasicFuture<T> implements Future<T>, Cancellable {
wait(waitTime);
if (this.completed) {
return getResult();
- } else {
- waitTime = msecs - (System.currentTimeMillis() - startTime);
- if (waitTime <= 0) {
- throw new TimeoutException();
- }
+ }
+ waitTime = msecs - (System.currentTimeMillis() - startTime);
+ if (waitTime <= 0) {
+ throw new TimeoutException();
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/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 4466aec..7b2330f 100644
--- a/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
@@ -69,20 +69,12 @@ public class BufferedHttpEntity extends HttpEntityWrapper {
@Override
public long getContentLength() {
- if (this.buffer != null) {
- return this.buffer.length;
- } else {
- return super.getContentLength();
- }
+ return this.buffer != null ? this.buffer.length : super.getContentLength();
}
@Override
public InputStream getContent() throws IOException {
- if (this.buffer != null) {
- return new ByteArrayInputStream(this.buffer);
- } else {
- return super.getContent();
- }
+ return this.buffer != null ? new ByteArrayInputStream(this.buffer) : super.getContent();
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/entity/ContentType.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/ContentType.java b/httpcore/src/main/java/org/apache/http/entity/ContentType.java
index 8398ddb..be2b43c 100644
--- a/httpcore/src/main/java/org/apache/http/entity/ContentType.java
+++ b/httpcore/src/main/java/org/apache/http/entity/ContentType.java
@@ -315,9 +315,8 @@ public final class ContentType implements Serializable {
final HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
if (elements.length > 0) {
return create(elements[0], true);
- } else {
- throw new ParseException("Invalid content type: " + s);
}
+ throw new ParseException("Invalid content type: " + s);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/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 165f9a9..cedd6a0 100644
--- a/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
+++ b/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
@@ -88,9 +88,9 @@ public class BHttpConnectionBase implements HttpInetConnection {
*
* @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.
+ * @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.
- * @param charencoder encoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
* @param messageConstraints Message constraints. If {@code null}
* {@link MessageConstraints#DEFAULT} will be used.
@@ -102,8 +102,8 @@ public class BHttpConnectionBase implements HttpInetConnection {
protected BHttpConnectionBase(
final int bufferSize,
final int fragmentSizeHint,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints messageConstraints,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
@@ -112,9 +112,9 @@ public class BHttpConnectionBase implements HttpInetConnection {
final HttpTransportMetricsImpl inTransportMetrics = new HttpTransportMetricsImpl();
final HttpTransportMetricsImpl outTransportMetrics = new HttpTransportMetricsImpl();
this.inBuffer = new SessionInputBufferImpl(inTransportMetrics, bufferSize, -1,
- messageConstraints != null ? messageConstraints : MessageConstraints.DEFAULT, chardecoder);
+ messageConstraints != null ? messageConstraints : MessageConstraints.DEFAULT, charDecoder);
this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, bufferSize, fragmentSizeHint,
- charencoder);
+ charEncoder);
this.messageConstraints = messageConstraints;
this.connMetrics = new HttpConnectionMetricsImpl(inTransportMetrics, outTransportMetrics);
this.incomingContentStrategy = incomingContentStrategy != null ? incomingContentStrategy :
@@ -291,9 +291,8 @@ public class BHttpConnectionBase implements HttpInetConnection {
} catch (final SocketException ignore) {
return -1;
}
- } else {
- return -1;
}
+ return -1;
}
@Override
@@ -395,9 +394,8 @@ public class BHttpConnectionBase implements HttpInetConnection {
NetUtils.formatAddress(buffer, remoteAddress);
}
return buffer.toString();
- } else {
- return "[Not bound]";
}
+ return "[Not bound]";
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/impl/ConnSupport.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/ConnSupport.java b/httpcore/src/main/java/org/apache/http/impl/ConnSupport.java
index a957629..d4320c3 100644
--- a/httpcore/src/main/java/org/apache/http/impl/ConnSupport.java
+++ b/httpcore/src/main/java/org/apache/http/impl/ConnSupport.java
@@ -51,9 +51,8 @@ public final class ConnSupport {
return charset.newDecoder()
.onMalformedInput(malformed != null ? malformed : CodingErrorAction.REPORT)
.onUnmappableCharacter(unmappable != null ? unmappable: CodingErrorAction.REPORT);
- } else {
- return null;
}
+ return null;
}
public static CharsetEncoder createEncoder(final ConnectionConfig cconfig) {
@@ -67,9 +66,8 @@ public final class ConnSupport {
return charset.newEncoder()
.onMalformedInput(malformed != null ? malformed : CodingErrorAction.REPORT)
.onUnmappableCharacter(unmappable != null ? unmappable: CodingErrorAction.REPORT);
- } else {
- return null;
}
+ return null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/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 44c614a..5ace305 100644
--- a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
+++ b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
@@ -67,9 +67,9 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
*
* @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.
+ * @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.
- * @param charencoder encoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
* @param constraints Message constraints. If {@code null}
* {@link MessageConstraints#DEFAULT} will be used.
@@ -85,14 +85,14 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
public DefaultBHttpClientConnection(
final int bufferSize,
final int fragmentSizeHint,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
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());
@@ -102,10 +102,10 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
public DefaultBHttpClientConnection(
final int bufferSize,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ 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) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/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 5e9f65d..26a8a58 100644
--- a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
+++ b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
@@ -65,9 +65,9 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
*
* @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.
+ * @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.
- * @param charencoder encoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
* @param constraints Message constraints. If {@code null}
* {@link MessageConstraints#DEFAULT} will be used.
@@ -83,14 +83,14 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
public DefaultBHttpServerConnection(
final int bufferSize,
final int fragmentSizeHint,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
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 :
@@ -101,10 +101,10 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
public DefaultBHttpServerConnection(
final int bufferSize,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ 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) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java b/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java
index c3106c5..b9f786c 100644
--- a/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java
+++ b/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java
@@ -67,20 +67,12 @@ public class HttpConnectionMetricsImpl implements HttpConnectionMetrics {
@Override
public long getReceivedBytesCount() {
- if (this.inTransportMetric != null) {
- return this.inTransportMetric.getBytesTransferred();
- } else {
- return -1;
- }
+ return this.inTransportMetric != null ? this.inTransportMetric.getBytesTransferred() : -1;
}
@Override
public long getSentBytesCount() {
- if (this.outTransportMetric != null) {
- return this.outTransportMetric.getBytesTransferred();
- } else {
- return -1;
- }
+ return this.outTransportMetric != null ? this.outTransportMetric.getBytesTransferred() : -1;
}
@Override
@@ -113,17 +105,13 @@ public class HttpConnectionMetricsImpl implements HttpConnectionMetrics {
} else if (RESPONSE_COUNT.equals(metricName)) {
value = Long.valueOf(responseCount);
} else if (RECEIVED_BYTES_COUNT.equals(metricName)) {
- if (this.inTransportMetric != null) {
- return Long.valueOf(this.inTransportMetric.getBytesTransferred());
- } else {
- return null;
- }
+ return this.inTransportMetric != null
+ ? Long.valueOf(this.inTransportMetric.getBytesTransferred())
+ : null;
} else if (SENT_BYTES_COUNT.equals(metricName)) {
- if (this.outTransportMetric != null) {
- return Long.valueOf(this.outTransportMetric.getBytesTransferred());
- } else {
- return null;
- }
+ return this.outTransportMetric != null
+ ? Long.valueOf(this.outTransportMetric.getBytesTransferred())
+ : null;
}
}
return value;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/impl/bootstrap/HttpServer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/bootstrap/HttpServer.java b/httpcore/src/main/java/org/apache/http/impl/bootstrap/HttpServer.java
index 696aae5..c2eef30 100644
--- a/httpcore/src/main/java/org/apache/http/impl/bootstrap/HttpServer.java
+++ b/httpcore/src/main/java/org/apache/http/impl/bootstrap/HttpServer.java
@@ -99,20 +99,12 @@ public class HttpServer {
public InetAddress getInetAddress() {
final ServerSocket localSocket = this.serverSocket;
- if (localSocket != null) {
- return localSocket.getInetAddress();
- } else {
- return null;
- }
+ return localSocket != null ? localSocket.getInetAddress() : null;
}
public int getLocalPort() {
final ServerSocket localSocket = this.serverSocket;
- if (localSocket != null) {
- return localSocket.getLocalPort();
- } else {
- return -1;
- }
+ return localSocket != null ? localSocket.getLocalPort() : -1;
}
public void start() throws IOException {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java b/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java
index d5dd611..aa18110 100644
--- a/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java
+++ b/httpcore/src/main/java/org/apache/http/impl/entity/LaxContentLengthStrategy.java
@@ -105,22 +105,18 @@ public class LaxContentLengthStrategy implements ContentLengthStrategy {
}
final Header contentLengthHeader = message.getFirstHeader(HTTP.CONTENT_LEN);
if (contentLengthHeader != null) {
- long contentlen = -1;
+ long contentLen = -1;
final Header[] headers = message.getHeaders(HTTP.CONTENT_LEN);
for (int i = headers.length - 1; i >= 0; i--) {
final Header header = headers[i];
try {
- contentlen = Long.parseLong(header.getValue());
+ contentLen = Long.parseLong(header.getValue());
break;
} catch (final NumberFormatException ignore) {
}
// See if we can have better luck with another header, if present
}
- if (contentlen >= 0) {
- return contentlen;
- } else {
- return IDENTITY;
- }
+ return contentLen >= 0 ? contentLen : IDENTITY;
}
return this.implicitLen;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/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 68fe740..7456c15 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
@@ -119,9 +119,8 @@ public class ChunkedInputStream extends InputStream {
if (this.in instanceof BufferInfo) {
final int len = ((BufferInfo) this.in).length();
return (int) Math.min(len, this.chunkSize - this.pos);
- } else {
- return 0;
}
+ return 0;
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/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 c4d8848..f2617d1 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
@@ -114,9 +114,8 @@ public class ContentLengthInputStream extends InputStream {
if (this.in instanceof BufferInfo) {
final int len = ((BufferInfo) this.in).length();
return Math.min(len, (int) (this.contentLength - this.pos));
- } else {
- return 0;
}
+ return 0;
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java b/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
index 19175bc..c5883c1 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
@@ -73,21 +73,21 @@ public class SessionOutputBufferImpl implements SessionOutputBuffer, BufferInfo
* @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.
- * @param charencoder charencoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder charEncoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
*/
public SessionOutputBufferImpl(
final HttpTransportMetricsImpl metrics,
final int bufferSize,
final int fragementSizeHint,
- final CharsetEncoder charencoder) {
+ final CharsetEncoder charEncoder) {
super();
Args.positive(bufferSize, "Buffer size");
Args.notNull(metrics, "HTTP transport metrcis");
this.metrics = metrics;
this.buffer = new ByteArrayBuffer(bufferSize);
this.fragementSizeHint = fragementSizeHint >= 0 ? fragementSizeHint : 0;
- this.encoder = charencoder;
+ this.encoder = charEncoder;
}
public SessionOutputBufferImpl(
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java b/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
index 1182d10..71ac53e 100644
--- a/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
+++ b/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
@@ -124,9 +124,8 @@ public class BasicHeaderElement implements HeaderElement, Cloneable {
return this.name.equals(that.name)
&& LangUtils.equals(this.value, that.value)
&& LangUtils.equals(this.parameters, that.parameters);
- } else {
- return false;
}
+ return false;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java b/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java
index 4bd16e8..2d9320d 100644
--- a/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java
+++ b/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java
@@ -77,14 +77,13 @@ public class BasicHeaderElementIterator implements HeaderElementIterator {
this.cursor = new ParserCursor(0, this.buffer.length());
this.cursor.updatePos(((FormattedHeader) h).getValuePos());
break;
- } else {
- final String value = h.getValue();
- if (value != null) {
- this.buffer = new CharArrayBuffer(value.length());
- this.buffer.append(value);
- this.cursor = new ParserCursor(0, this.buffer.length());
- break;
- }
+ }
+ final String value = h.getValue();
+ if (value != null) {
+ this.buffer = new CharArrayBuffer(value.length());
+ this.buffer.append(value);
+ this.cursor = new ParserCursor(0, this.buffer.length());
+ break;
}
}
}
[3/4] httpcomponents-core git commit: - Always use blocks - Add
missing serial version ID (default 1L) - Camel-case names. - Don't nest in
else clause unnecessarily. - Remove declared exceptions that are not thrown
(but don't break BC.)
Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncRequestConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncRequestConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncRequestConsumer.java
index 4057b11..cc765fd 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncRequestConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncRequestConsumer.java
@@ -90,11 +90,11 @@ public abstract class AbstractAsyncRequestConsumer<T> implements HttpAsyncReques
* to find out whether or not the message content has been fully consumed.
*
* @param decoder content decoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
protected abstract void onContentReceived(
- ContentDecoder decoder, IOControl ioctrl) throws IOException;
+ ContentDecoder decoder, IOControl ioControl) throws IOException;
/**
* Invoked to generate a result object from the received HTTP request
@@ -141,8 +141,8 @@ public abstract class AbstractAsyncRequestConsumer<T> implements HttpAsyncReques
*/
@Override
public final void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
- onContentReceived(decoder, ioctrl);
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
+ onContentReceived(decoder, ioControl);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
index 0459fd2..da7deed 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
@@ -78,11 +78,11 @@ public abstract class AbstractAsyncResponseConsumer<T> implements HttpAsyncRespo
* to find out whether or not the message content has been fully consumed.
*
* @param decoder content decoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
protected abstract void onContentReceived(
- ContentDecoder decoder, IOControl ioctrl) throws IOException;
+ ContentDecoder decoder, IOControl ioControl) throws IOException;
/**
* Invoked if the response message encloses a content entity.
@@ -143,8 +143,8 @@ public abstract class AbstractAsyncResponseConsumer<T> implements HttpAsyncRespo
*/
@Override
public final void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
- onContentReceived(decoder, ioctrl);
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
+ onContentReceived(decoder, ioControl);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncClientExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncClientExchangeHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncClientExchangeHandler.java
index eb3eabe..a1b63d1 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncClientExchangeHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncClientExchangeHandler.java
@@ -62,7 +62,7 @@ public class BasicAsyncClientExchangeHandler<T> implements HttpAsyncClientExchan
private final BasicFuture<T> future;
private final HttpContext localContext;
private final NHttpClientConnection conn;
- private final HttpProcessor httppocessor;
+ private final HttpProcessor httpPocessor;
private final ConnectionReuseStrategy connReuseStrategy;
private final AtomicBoolean requestSent;
private final AtomicBoolean keepAlive;
@@ -76,7 +76,7 @@ public class BasicAsyncClientExchangeHandler<T> implements HttpAsyncClientExchan
* @param callback the future callback invoked when the operation is completed.
* @param localContext the local execution context.
* @param conn the actual connection.
- * @param httppocessor the HTTP protocol processor.
+ * @param httpPocessor the HTTP protocol processor.
* @param connReuseStrategy the connection re-use strategy.
*/
public BasicAsyncClientExchangeHandler(
@@ -85,7 +85,7 @@ public class BasicAsyncClientExchangeHandler<T> implements HttpAsyncClientExchan
final FutureCallback<T> callback,
final HttpContext localContext,
final NHttpClientConnection conn,
- final HttpProcessor httppocessor,
+ final HttpProcessor httpPocessor,
final ConnectionReuseStrategy connReuseStrategy) {
super();
this.requestProducer = Args.notNull(requestProducer, "Request producer");
@@ -93,7 +93,7 @@ public class BasicAsyncClientExchangeHandler<T> implements HttpAsyncClientExchan
this.future = new BasicFuture<T>(callback);
this.localContext = Args.notNull(localContext, "HTTP context");
this.conn = Args.notNull(conn, "HTTP connection");
- this.httppocessor = Args.notNull(httppocessor, "HTTP processor");
+ this.httpPocessor = Args.notNull(httpPocessor, "HTTP processor");
this.connReuseStrategy = connReuseStrategy != null ? connReuseStrategy :
DefaultConnectionReuseStrategy.INSTANCE;
this.requestSent = new AtomicBoolean(false);
@@ -108,15 +108,15 @@ public class BasicAsyncClientExchangeHandler<T> implements HttpAsyncClientExchan
* @param responseConsumer the response consumer.
* @param localContext the local execution context.
* @param conn the actual connection.
- * @param httppocessor the HTTP protocol processor.
+ * @param httpPocessor the HTTP protocol processor.
*/
public BasicAsyncClientExchangeHandler(
final HttpAsyncRequestProducer requestProducer,
final HttpAsyncResponseConsumer<T> responseConsumer,
final HttpContext localContext,
final NHttpClientConnection conn,
- final HttpProcessor httppocessor) {
- this(requestProducer, responseConsumer, null, localContext, conn, httppocessor, null);
+ final HttpProcessor httpPocessor) {
+ this(requestProducer, responseConsumer, null, localContext, conn, httpPocessor, null);
}
public Future<T> getFuture() {
@@ -152,14 +152,14 @@ public class BasicAsyncClientExchangeHandler<T> implements HttpAsyncClientExchan
final HttpRequest request = this.requestProducer.generateRequest();
this.localContext.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
this.localContext.setAttribute(HttpCoreContext.HTTP_CONNECTION, this.conn);
- this.httppocessor.process(request, this.localContext);
+ this.httpPocessor.process(request, this.localContext);
return request;
}
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
- this.requestProducer.produceContent(encoder, ioctrl);
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
+ this.requestProducer.produceContent(encoder, ioControl);
}
@Override
@@ -171,15 +171,15 @@ public class BasicAsyncClientExchangeHandler<T> implements HttpAsyncClientExchan
@Override
public void responseReceived(final HttpResponse response) throws IOException, HttpException {
this.localContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
- this.httppocessor.process(response, this.localContext);
+ this.httpPocessor.process(response, this.localContext);
this.responseConsumer.responseReceived(response);
this.keepAlive.set(this.connReuseStrategy.keepAlive(response, this.localContext));
}
@Override
public void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
- this.responseConsumer.consumeContent(decoder, ioctrl);
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
+ this.responseConsumer.consumeContent(decoder, ioControl);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestConsumer.java
index 9524169..fb60724 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestConsumer.java
@@ -82,7 +82,7 @@ public class BasicAsyncRequestConsumer extends AbstractAsyncRequestConsumer<Http
@Override
protected void onContentReceived(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
Asserts.notNull(this.buf, "Content buffer");
this.buf.consumeContent(decoder);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java
index 2c7a5aa..72575ec 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestProducer.java
@@ -120,9 +120,9 @@ public class BasicAsyncRequestProducer implements HttpAsyncRequestProducer {
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
if (this.producer != null) {
- this.producer.produceContent(encoder, ioctrl);
+ this.producer.produceContent(encoder, ioControl);
if (encoder.isCompleted()) {
this.producer.close();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseConsumer.java
index 66fd4e3..60b13bf 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseConsumer.java
@@ -80,7 +80,7 @@ public class BasicAsyncResponseConsumer extends AbstractAsyncResponseConsumer<Ht
@Override
protected void onContentReceived(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
Asserts.notNull(this.buf, "Content buffer");
this.buf.consumeContent(decoder);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java
index 8e83c89..6450340 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncResponseProducer.java
@@ -104,9 +104,9 @@ public class BasicAsyncResponseProducer implements HttpAsyncResponseProducer {
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
if (this.producer != null) {
- this.producer.produceContent(encoder, ioctrl);
+ this.producer.produceContent(encoder, ioControl);
if (encoder.isCompleted()) {
this.producer.close();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java
index 6a2df67..d9a9209 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/ErrorResponseProducer.java
@@ -78,8 +78,8 @@ public class ErrorResponseProducer implements HttpAsyncResponseProducer {
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
- this.contentProducer.produceContent(encoder, ioctrl);
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
+ this.contentProducer.produceContent(encoder, ioControl);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientExchangeHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientExchangeHandler.java
index d66f356..71f0c74 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientExchangeHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncClientExchangeHandler.java
@@ -84,10 +84,10 @@ public interface HttpAsyncClientExchangeHandler extends Closeable, Cancellable {
* to resume output event notifications when more content is made available.
*
* @param encoder content encoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
- void produceContent(ContentEncoder encoder, IOControl ioctrl) throws IOException;
+ void produceContent(ContentEncoder encoder, IOControl ioControl) throws IOException;
/**
* Invoked to signal that the request has been fully written out.
@@ -121,10 +121,10 @@ public interface HttpAsyncClientExchangeHandler extends Closeable, Cancellable {
* processing more content.
*
* @param decoder content decoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
- void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException;
+ void consumeContent(ContentDecoder decoder, IOControl ioControl) throws IOException;
/**
* Invoked to signal that the response has been fully processed.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestConsumer.java
index 2739b62..f23848e 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestConsumer.java
@@ -73,10 +73,10 @@ public interface HttpAsyncRequestConsumer<T> extends Closeable {
* processing more content.
*
* @param decoder content decoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
- void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException;
+ void consumeContent(ContentDecoder decoder, IOControl ioControl) throws IOException;
/**
* Invoked to signal that the request has been fully processed.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestProducer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestProducer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestProducer.java
index 3d320ba..3b49f4f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestProducer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestProducer.java
@@ -85,10 +85,10 @@ public interface HttpAsyncRequestProducer extends Closeable {
* to resume output event notifications when more content is made available.
*
* @param encoder content encoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
- void produceContent(ContentEncoder encoder, IOControl ioctrl) throws IOException;
+ void produceContent(ContentEncoder encoder, IOControl ioControl) throws IOException;
/**
* Invoked to signal that the request has been fully written out.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseConsumer.java
index 257bff5..cb165bb 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseConsumer.java
@@ -73,10 +73,10 @@ public interface HttpAsyncResponseConsumer<T> extends Closeable, Cancellable {
* processing more content.
*
* @param decoder content decoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
- void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException;
+ void consumeContent(ContentDecoder decoder, IOControl ioControl) throws IOException;
/**
* Invoked to signal that the response has been fully processed.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseProducer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseProducer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseProducer.java
index e66e76a..dcedfc6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseProducer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncResponseProducer.java
@@ -66,10 +66,10 @@ public interface HttpAsyncResponseProducer extends Closeable {
* to resume output event notifications when more content is made available.
*
* @param encoder content encoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
* @throws IOException in case of an I/O error
*/
- void produceContent(ContentEncoder encoder, IOControl ioctrl) throws IOException;
+ void produceContent(ContentEncoder encoder, IOControl ioControl) throws IOException;
/**
* Invoked to signal that the response has been fully written out.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
index a7cb2a6..c7ddba1 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
@@ -312,9 +312,8 @@ public class HttpAsyncService implements NHttpServerEventHandler {
closeHandlers(state);
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
- } else {
- log(ex);
}
+ log(ex);
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java
index 4ade458..00b1b22 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java
@@ -51,7 +51,7 @@ class NullRequestConsumer implements HttpAsyncRequestConsumer<Object> {
@Override
public void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
int lastRead;
do {
this.buffer.clear();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/protocol/PipeliningClientExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/PipeliningClientExchangeHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/PipeliningClientExchangeHandler.java
index 5c21768..50d1886 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/PipeliningClientExchangeHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/PipeliningClientExchangeHandler.java
@@ -72,7 +72,7 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
private final BasicFuture<List<T>> future;
private final HttpContext localContext;
private final NHttpClientConnection conn;
- private final HttpProcessor httppocessor;
+ private final HttpProcessor httpPocessor;
private final ConnectionReuseStrategy connReuseStrategy;
private final AtomicReference<HttpAsyncRequestProducer> requestProducerRef;
@@ -88,7 +88,7 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
* @param callback the future callback invoked when the operation is completed.
* @param localContext the local execution context.
* @param conn the actual connection.
- * @param httppocessor the HTTP protocol processor.
+ * @param httpPocessor the HTTP protocol processor.
* @param connReuseStrategy the connection re-use strategy.
*/
public PipeliningClientExchangeHandler(
@@ -97,7 +97,7 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
final FutureCallback<List<T>> callback,
final HttpContext localContext,
final NHttpClientConnection conn,
- final HttpProcessor httppocessor,
+ final HttpProcessor httpPocessor,
final ConnectionReuseStrategy connReuseStrategy) {
super();
Args.notEmpty(requestProducers, "Request producer list");
@@ -111,7 +111,7 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
this.future = new BasicFuture<List<T>>(callback);
this.localContext = Args.notNull(localContext, "HTTP context");
this.conn = Args.notNull(conn, "HTTP connection");
- this.httppocessor = Args.notNull(httppocessor, "HTTP processor");
+ this.httpPocessor = Args.notNull(httpPocessor, "HTTP processor");
this.connReuseStrategy = connReuseStrategy != null ? connReuseStrategy :
DefaultConnectionReuseStrategy.INSTANCE;
this.localContext.setAttribute(HttpCoreContext.HTTP_CONNECTION, this.conn);
@@ -128,15 +128,15 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
* @param responseConsumers the response consumers.
* @param localContext the local execution context.
* @param conn the actual connection.
- * @param httppocessor the HTTP protocol processor.
+ * @param httpPocessor the HTTP protocol processor.
*/
public PipeliningClientExchangeHandler(
final List<? extends HttpAsyncRequestProducer> requestProducers,
final List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
final HttpContext localContext,
final NHttpClientConnection conn,
- final HttpProcessor httppocessor) {
- this(requestProducers, responseConsumers, null, localContext, conn, httppocessor, null);
+ final HttpProcessor httpPocessor) {
+ this(requestProducers, responseConsumers, null, localContext, conn, httpPocessor, null);
}
public Future<List<T>> getFuture() {
@@ -184,17 +184,17 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
}
this.requestProducerRef.set(requestProducer);
final HttpRequest request = requestProducer.generateRequest();
- this.httppocessor.process(request, this.localContext);
+ this.httpPocessor.process(request, this.localContext);
this.requestQueue.add(request);
return request;
}
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
final HttpAsyncRequestProducer requestProducer = this.requestProducerRef.get();
Asserts.check(requestProducer != null, "Inconsistent state: request producer is null");
- requestProducer.produceContent(encoder, ioctrl);
+ requestProducer.produceContent(encoder, ioControl);
}
@Override
@@ -217,7 +217,7 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
this.localContext.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
this.localContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
- this.httppocessor.process(response, this.localContext);
+ this.httpPocessor.process(response, this.localContext);
responseConsumer.responseReceived(response);
this.keepAlive.set(this.connReuseStrategy.keepAlive(response, this.localContext));
@@ -225,10 +225,10 @@ public class PipeliningClientExchangeHandler<T> implements HttpAsyncClientExchan
@Override
public void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
final HttpAsyncResponseConsumer<T> responseConsumer = this.responseConsumerRef.get();
Asserts.check(responseConsumer != null, "Inconsistent state: response consumer is null");
- responseConsumer.consumeContent(decoder, ioctrl);
+ responseConsumer.consumeContent(decoder, ioControl);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
index 297989b..8342bed 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
@@ -65,8 +65,8 @@ import org.apache.http.util.Asserts;
* SSLContext sslContext = SSLContext.getInstance("SSL");
* sslContext.init(null, null, null);
* SSLIOSession sslsession = new SSLIOSession(
- * iosession, SSLMode.CLIENT, sslContext, null);
- * iosession.setAttribute(SSLIOSession.SESSION_KEY, sslsession);
+ * ioSession, SSLMode.CLIENT, sslContext, null);
+ * ioSession.setAttribute(SSLIOSession.SESSION_KEY, sslsession);
* </pre>
*
* @since 4.2
@@ -591,13 +591,8 @@ public class SSLIOSession implements IOSession, SessionBufferStatus, SocketAcces
this.inPlain.release();
}
return n;
- } else {
- if (this.endOfStream) {
- return -1;
- } else {
- return 0;
- }
}
+ return this.endOfStream ? -1 : 0;
}
@Override
@@ -772,11 +767,7 @@ public class SSLIOSession implements IOSession, SessionBufferStatus, SocketAcces
@Override
public Socket getSocket(){
- if (this.session instanceof SocketAccessor){
- return ((SocketAccessor) this.session).getSocket();
- } else {
- return null;
- }
+ return this.session instanceof SocketAccessor ? ((SocketAccessor) this.session).getSocket() : null;
}
private class InternalByteChannel implements ByteChannel {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
index 72aa021..9b82739 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
@@ -58,7 +58,7 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
private final ReentrantLock lock;
private final Condition condition;
- private volatile IOControl ioctrl;
+ private volatile IOControl ioControl;
private volatile boolean shutdown = false;
private volatile boolean endOfStream = false;
@@ -66,9 +66,9 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
* @deprecated (4.3) use {@link SharedInputBuffer#SharedInputBuffer(int, ByteBufferAllocator)}
*/
@Deprecated
- public SharedInputBuffer(final int bufferSize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
+ public SharedInputBuffer(final int bufferSize, final IOControl ioControl, final ByteBufferAllocator allocator) {
super(bufferSize, allocator);
- this.ioctrl = ioctrl;
+ this.ioControl = ioControl;
this.lock = new ReentrantLock();
this.condition = this.lock.newCondition();
}
@@ -115,14 +115,14 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
/**
* @since 4.3
*/
- public int consumeContent(final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ public int consumeContent(final ContentDecoder decoder, final IOControl ioControl) throws IOException {
if (this.shutdown) {
return -1;
}
this.lock.lock();
try {
- if (ioctrl != null) {
- this.ioctrl = ioctrl;
+ if (ioControl != null) {
+ this.ioControl = ioControl;
}
setInputMode();
int totalRead = 0;
@@ -134,8 +134,8 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
this.endOfStream = true;
}
if (!this.buffer.hasRemaining()) {
- if (this.ioctrl != null) {
- this.ioctrl.suspendInput();
+ if (this.ioControl != null) {
+ this.ioControl.suspendInput();
}
}
this.condition.signalAll();
@@ -197,8 +197,8 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
if (this.shutdown) {
throw new InterruptedIOException("Input operation aborted");
}
- if (this.ioctrl != null) {
- this.ioctrl.requestInput();
+ if (this.ioControl != null) {
+ this.ioControl.requestInput();
}
this.condition.await();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
index 98b8a75..ef1df00 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
@@ -60,7 +60,7 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
private final ReentrantLock lock;
private final Condition condition;
- private volatile IOControl ioctrl;
+ private volatile IOControl ioControl;
private volatile boolean shutdown = false;
private volatile boolean endOfStream = false;
@@ -68,10 +68,10 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
* @deprecated (4.3) use {@link SharedOutputBuffer#SharedOutputBuffer(int, ByteBufferAllocator)}
*/
@Deprecated
- public SharedOutputBuffer(final int bufferSize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
+ public SharedOutputBuffer(final int bufferSize, final IOControl ioControl, final ByteBufferAllocator allocator) {
super(bufferSize, allocator);
- Args.notNull(ioctrl, "I/O content control");
- this.ioctrl = ioctrl;
+ Args.notNull(ioControl, "I/O content control");
+ this.ioControl = ioControl;
this.lock = new ReentrantLock();
this.condition = this.lock.newCondition();
}
@@ -158,14 +158,14 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
/**
* @since 4.3
*/
- public int produceContent(final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ public int produceContent(final ContentEncoder encoder, final IOControl ioControl) throws IOException {
if (this.shutdown) {
return -1;
}
this.lock.lock();
try {
- if (ioctrl != null) {
- this.ioctrl = ioctrl;
+ if (ioControl != null) {
+ this.ioControl = ioControl;
}
setOutputMode();
int bytesWritten = 0;
@@ -183,8 +183,8 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
}
if (!this.endOfStream) {
// suspend output events
- if (this.ioctrl != null) {
- this.ioctrl.suspendOutput();
+ if (this.ioControl != null) {
+ this.ioControl.suspendOutput();
}
}
}
@@ -274,8 +274,8 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
if (this.shutdown) {
throw new InterruptedIOException("Output operation aborted");
}
- if (this.ioctrl != null) {
- this.ioctrl.requestOutput();
+ if (this.ioControl != null) {
+ this.ioControl.requestOutput();
}
this.condition.await();
}
@@ -295,8 +295,8 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
return;
}
this.endOfStream = true;
- if (this.ioctrl != null) {
- this.ioctrl.requestOutput();
+ if (this.ioControl != null) {
+ this.ioControl.requestOutput();
}
} finally {
this.lock.unlock();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
index 3cb35d2..f404bfb 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
@@ -159,9 +159,9 @@ public class TestDefaultNHttpClientConnection {
@Override
public Void answer(final InvocationOnMock invocation) throws Throwable {
final Object[] args = invocation.getArguments();
- final IOControl ioctrl = (IOControl) args[0];
+ final IOControl ioControl = (IOControl) args[0];
final ContentEncoder encoder = (ContentEncoder) args[1];
- contentProducer.produceContent(encoder, ioctrl);
+ contentProducer.produceContent(encoder, ioControl);
return null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
index 7887683..334c941 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpServerConnection.java
@@ -159,9 +159,9 @@ public class TestDefaultNHttpServerConnection {
@Override
public Void answer(final InvocationOnMock invocation) throws Throwable {
final Object[] args = invocation.getArguments();
- final IOControl ioctrl = (IOControl) args[0];
+ final IOControl ioControl = (IOControl) args[0];
final ContentEncoder encoder = (ContentEncoder) args[1];
- contentProducer.produceContent(encoder, ioctrl);
+ contentProducer.produceContent(encoder, ioControl);
return null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
index 78f9cdc..25e2781 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/pool/TestBasicNIOConnPool.java
@@ -52,16 +52,16 @@ public class TestBasicNIOConnPool {
static class LocalPool extends BasicNIOConnPool {
public LocalPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
final int connectTimeout) {
- super(ioreactor, connFactory, connectTimeout);
+ super(ioReactor, connFactory, connectTimeout);
}
public LocalPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final ConnectionConfig config) {
- super(ioreactor, config);
+ super(ioReactor, config);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java b/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
index fab6a58..784b423 100644
--- a/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
+++ b/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
@@ -74,14 +74,14 @@ public class TestDefaultListeningIOReactor {
public void testEndpointUpAndDown() throws Exception {
final IOEventDispatch eventDispatch = createIOEventDispatch();
final IOReactorConfig config = IOReactorConfig.custom().setIoThreadCount(1).build();
- final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(config);
+ final ListeningIOReactor ioReactor = new DefaultListeningIOReactor(config);
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
- ioreactor.execute(eventDispatch);
+ ioReactor.execute(eventDispatch);
} catch (final IOException ex) {
}
}
@@ -90,24 +90,24 @@ public class TestDefaultListeningIOReactor {
t.start();
- Set<ListenerEndpoint> endpoints = ioreactor.getEndpoints();
+ Set<ListenerEndpoint> endpoints = ioReactor.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(0, endpoints.size());
- final ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(0));
+ final ListenerEndpoint endpoint1 = ioReactor.listen(new InetSocketAddress(0));
endpoint1.waitFor();
- final ListenerEndpoint endpoint2 = ioreactor.listen(new InetSocketAddress(0));
+ final ListenerEndpoint endpoint2 = ioReactor.listen(new InetSocketAddress(0));
endpoint2.waitFor();
final int port = ((InetSocketAddress) endpoint2.getAddress()).getPort();
- endpoints = ioreactor.getEndpoints();
+ endpoints = ioReactor.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(2, endpoints.size());
endpoint1.close();
- endpoints = ioreactor.getEndpoints();
+ endpoints = ioReactor.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(1, endpoints.size());
@@ -115,17 +115,17 @@ public class TestDefaultListeningIOReactor {
Assert.assertEquals(port, ((InetSocketAddress) endpoint.getAddress()).getPort());
- ioreactor.shutdown(1000);
+ ioReactor.shutdown(1000);
t.join(1000);
- Assert.assertEquals(IOReactorStatus.SHUT_DOWN, ioreactor.getStatus());
+ Assert.assertEquals(IOReactorStatus.SHUT_DOWN, ioReactor.getStatus());
}
@Test
public void testEndpointAlreadyBoundFatal() throws Exception {
final IOEventDispatch eventDispatch = createIOEventDispatch();
final IOReactorConfig config = IOReactorConfig.custom().setIoThreadCount(1).build();
- final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(config);
+ final ListeningIOReactor ioReactor = new DefaultListeningIOReactor(config);
final CountDownLatch latch = new CountDownLatch(1);
@@ -134,7 +134,7 @@ public class TestDefaultListeningIOReactor {
@Override
public void run() {
try {
- ioreactor.execute(eventDispatch);
+ ioReactor.execute(eventDispatch);
Assert.fail("IOException should have been thrown");
} catch (final IOException ex) {
latch.countDown();
@@ -145,35 +145,35 @@ public class TestDefaultListeningIOReactor {
t.start();
- final ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(0));
+ final ListenerEndpoint endpoint1 = ioReactor.listen(new InetSocketAddress(0));
endpoint1.waitFor();
final int port = ((InetSocketAddress) endpoint1.getAddress()).getPort();
- final ListenerEndpoint endpoint2 = ioreactor.listen(new InetSocketAddress(port));
+ final ListenerEndpoint endpoint2 = ioReactor.listen(new InetSocketAddress(port));
endpoint2.waitFor();
Assert.assertNotNull(endpoint2.getException());
// I/O reactor is now expected to be shutting down
latch.await(2000, TimeUnit.MILLISECONDS);
- Assert.assertTrue(ioreactor.getStatus().compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0);
+ Assert.assertTrue(ioReactor.getStatus().compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0);
- final Set<ListenerEndpoint> endpoints = ioreactor.getEndpoints();
+ final Set<ListenerEndpoint> endpoints = ioReactor.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(0, endpoints.size());
- ioreactor.shutdown(1000);
+ ioReactor.shutdown(1000);
t.join(1000);
- Assert.assertEquals(IOReactorStatus.SHUT_DOWN, ioreactor.getStatus());
+ Assert.assertEquals(IOReactorStatus.SHUT_DOWN, ioReactor.getStatus());
}
@Test
public void testEndpointAlreadyBoundNonFatal() throws Exception {
final IOEventDispatch eventDispatch = createIOEventDispatch();
final IOReactorConfig config = IOReactorConfig.custom().setIoThreadCount(1).build();
- final DefaultListeningIOReactor ioreactor = new DefaultListeningIOReactor(config);
+ final DefaultListeningIOReactor ioReactor = new DefaultListeningIOReactor(config);
- ioreactor.setExceptionHandler(new IOReactorExceptionHandler() {
+ ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
@Override
public boolean handle(final IOException ex) {
@@ -192,7 +192,7 @@ public class TestDefaultListeningIOReactor {
@Override
public void run() {
try {
- ioreactor.execute(eventDispatch);
+ ioReactor.execute(eventDispatch);
} catch (final IOException ex) {
}
}
@@ -201,22 +201,22 @@ public class TestDefaultListeningIOReactor {
t.start();
- final ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(9999));
+ final ListenerEndpoint endpoint1 = ioReactor.listen(new InetSocketAddress(9999));
endpoint1.waitFor();
- final ListenerEndpoint endpoint2 = ioreactor.listen(new InetSocketAddress(9999));
+ final ListenerEndpoint endpoint2 = ioReactor.listen(new InetSocketAddress(9999));
endpoint2.waitFor();
Assert.assertNotNull(endpoint2.getException());
// Sleep a little to make sure the I/O reactor is not shutting down
Thread.sleep(500);
- Assert.assertEquals(IOReactorStatus.ACTIVE, ioreactor.getStatus());
+ Assert.assertEquals(IOReactorStatus.ACTIVE, ioReactor.getStatus());
- ioreactor.shutdown(1000);
+ ioReactor.shutdown(1000);
t.join(1000);
- Assert.assertEquals(IOReactorStatus.SHUT_DOWN, ioreactor.getStatus());
+ Assert.assertEquals(IOReactorStatus.SHUT_DOWN, ioReactor.getStatus());
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java
index 435c0c8..f3f96f3 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java
@@ -93,9 +93,9 @@ public class TestCustomSSL {
@Override
public void verify(
- final IOSession iosession, final SSLSession sslsession) throws SSLException {
+ final IOSession ioSession, final SSLSession sslsession) throws SSLException {
final BigInteger sslid = new BigInteger(sslsession.getId());
- iosession.setAttribute("ssl-id", sslid);
+ ioSession.setAttribute("ssl-id", sslid);
}
};
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java
index 2524888..48cc77f 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java
@@ -98,9 +98,9 @@ public class TestHttpAsyncHandlerCancellable extends HttpCoreNIOTestBase {
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
// suspend output
- ioctrl.suspendOutput();
+ ioControl.suspendOutput();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java
index a99a920..8601682 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java
@@ -230,8 +230,8 @@ public class TestHttpAsyncPrematureTermination extends HttpCoreNIOTestBase {
@Override
public synchronized void produceContent(
final ContentEncoder encoder,
- final IOControl ioctrl) throws IOException {
- ioctrl.shutdown();
+ final IOControl ioControl) throws IOException {
+ ioControl.shutdown();
}
});
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java
index 8f4c648..797a6a5 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java
@@ -211,7 +211,7 @@ public class TestTruncatedChunks extends HttpCoreNIOTestBase {
@Override
protected void onContentReceived(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
boolean finished = false;
try {
this.buffer.consumeContent(decoder);
[4/4] httpcomponents-core git commit: - Always use blocks - Add
missing serial version ID (default 1L) - Camel-case names. - Don't nest in
else clause unnecessarily. - Remove declared exceptions that are not thrown
(but don't break BC.)
Posted by ol...@apache.org.
- Always use blocks
- Add missing serial version ID (default 1L)
- Camel-case names.
- Don't nest in else clause unnecessarily.
- Remove declared exceptions that are not thrown (but don't break BC.)
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/07a4acf7
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/07a4acf7
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/07a4acf7
Branch: refs/heads/4.4.x
Commit: 07a4acf78f0d7a9f43f5a04d7348bed2e549f17b
Parents: 14e3a19
Author: Gary Gregory <ga...@gmail.com>
Authored: Tue Aug 14 08:58:48 2018 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Aug 14 20:49:43 2018 +0200
----------------------------------------------------------------------
.../apache/http/benchmark/BenchmarkWorker.java | 6 +-
.../http/examples/nio/NHttpReverseProxy.java | 28 +-
.../nio/reactor/SSLIOSessionHandlerAdaptor.java | 4 +-
.../http/impl/nio/reactor/SSLSetupHandler.java | 4 +-
.../nio/reactor/SSLSetupHandlerAdaptor.java | 4 +-
.../impl/nio/ssl/SSLClientIOEventDispatch.java | 14 +-
.../impl/nio/ssl/SSLServerIOEventDispatch.java | 14 +-
.../http/nio/entity/BufferingNHttpEntity.java | 2 +-
.../entity/ConsumingNHttpEntityTemplate.java | 4 +-
.../apache/http/nio/entity/ContentListener.java | 4 +-
.../http/nio/entity/NHttpEntityWrapper.java | 2 +-
.../http/nio/entity/SkipContentListener.java | 2 +-
.../BasicAsyncRequestExecutionHandler.java | 22 +-
.../http/nio/protocol/NullNHttpEntity.java | 2 +-
.../impl/nio/DefaultNHttpClientConnection.java | 16 +-
.../impl/nio/DefaultNHttpServerConnection.java | 16 +-
.../nio/NHttpClientEventHandlerAdaptor.java | 3 +-
.../http/impl/nio/NHttpConnectionBase.java | 55 ++--
.../nio/NHttpServerEventHandlerAdaptor.java | 3 +-
.../nio/SSLNHttpClientConnectionFactory.java | 14 +-
.../nio/SSLNHttpServerConnectionFactory.java | 14 +-
.../http/impl/nio/SessionHttpContext.java | 16 +-
.../impl/nio/codecs/AbstractContentEncoder.java | 7 +-
.../impl/nio/codecs/AbstractMessageParser.java | 3 +-
.../http/impl/nio/codecs/ChunkDecoder.java | 6 +-
.../http/impl/nio/pool/BasicNIOConnPool.java | 24 +-
.../impl/nio/reactor/AbstractIODispatch.java | 50 +--
.../http/impl/nio/reactor/ChannelEntry.java | 6 +-
.../nio/reactor/DefaultListeningIOReactor.java | 3 +-
.../http/impl/nio/reactor/IOSessionImpl.java | 22 +-
.../http/impl/nio/reactor/InterestOpEntry.java | 7 +-
.../http/nio/entity/ConsumingNHttpEntity.java | 4 +-
.../http/nio/entity/ContentInputStream.java | 6 +-
.../nio/entity/EntityAsyncContentProducer.java | 2 +-
.../nio/entity/HttpAsyncContentProducer.java | 4 +-
.../http/nio/entity/NByteArrayEntity.java | 2 +-
.../org/apache/http/nio/entity/NFileEntity.java | 2 +-
.../apache/http/nio/entity/NStringEntity.java | 2 +-
.../http/nio/entity/ProducingNHttpEntity.java | 4 +-
.../http/nio/pool/AbstractNIOConnPool.java | 49 ++-
.../apache/http/nio/pool/RouteSpecificPool.java | 11 +-
.../protocol/AbstractAsyncRequestConsumer.java | 8 +-
.../protocol/AbstractAsyncResponseConsumer.java | 8 +-
.../BasicAsyncClientExchangeHandler.java | 26 +-
.../nio/protocol/BasicAsyncRequestConsumer.java | 2 +-
.../nio/protocol/BasicAsyncRequestProducer.java | 4 +-
.../protocol/BasicAsyncResponseConsumer.java | 2 +-
.../protocol/BasicAsyncResponseProducer.java | 4 +-
.../nio/protocol/ErrorResponseProducer.java | 4 +-
.../HttpAsyncClientExchangeHandler.java | 8 +-
.../nio/protocol/HttpAsyncRequestConsumer.java | 4 +-
.../nio/protocol/HttpAsyncRequestProducer.java | 4 +-
.../nio/protocol/HttpAsyncResponseConsumer.java | 4 +-
.../nio/protocol/HttpAsyncResponseProducer.java | 4 +-
.../http/nio/protocol/HttpAsyncService.java | 3 +-
.../http/nio/protocol/NullRequestConsumer.java | 2 +-
.../PipeliningClientExchangeHandler.java | 26 +-
.../http/nio/reactor/ssl/SSLIOSession.java | 17 +-
.../apache/http/nio/util/SharedInputBuffer.java | 20 +-
.../http/nio/util/SharedOutputBuffer.java | 26 +-
.../nio/TestDefaultNHttpClientConnection.java | 4 +-
.../nio/TestDefaultNHttpServerConnection.java | 4 +-
.../impl/nio/pool/TestBasicNIOConnPool.java | 8 +-
.../reactor/TestDefaultListeningIOReactor.java | 50 +--
.../http/nio/integration/TestCustomSSL.java | 4 +-
.../TestHttpAsyncHandlerCancellable.java | 4 +-
.../TestHttpAsyncPrematureTermination.java | 4 +-
.../nio/integration/TestTruncatedChunks.java | 2 +-
.../apache/http/nio/pool/TestNIOConnPool.java | 302 +++++++++----------
.../protocol/TestBasicAsyncRequestConsumer.java | 6 +-
.../TestBasicAsyncResponseConsumer.java | 6 +-
.../nio/testserver/ClientConnectionFactory.java | 12 +-
.../http/nio/testserver/LoggingIOSession.java | 14 +-
.../LoggingNHttpClientConnection.java | 24 +-
.../LoggingNHttpServerConnection.java | 24 +-
.../nio/testserver/ServerConnectionFactory.java | 12 +-
.../http/impl/SocketHttpServerConnection.java | 6 +-
.../src/main/java/org/apache/http/HttpHost.java | 6 +-
.../org/apache/http/concurrent/BasicFuture.java | 9 +-
.../apache/http/entity/BufferedHttpEntity.java | 12 +-
.../org/apache/http/entity/ContentType.java | 3 +-
.../apache/http/impl/BHttpConnectionBase.java | 18 +-
.../java/org/apache/http/impl/ConnSupport.java | 6 +-
.../http/impl/DefaultBHttpClientConnection.java | 16 +-
.../http/impl/DefaultBHttpServerConnection.java | 16 +-
.../http/impl/HttpConnectionMetricsImpl.java | 28 +-
.../apache/http/impl/bootstrap/HttpServer.java | 12 +-
.../impl/entity/LaxContentLengthStrategy.java | 10 +-
.../apache/http/impl/io/ChunkedInputStream.java | 3 +-
.../http/impl/io/ContentLengthInputStream.java | 3 +-
.../http/impl/io/SessionOutputBufferImpl.java | 6 +-
.../apache/http/message/BasicHeaderElement.java | 3 +-
.../message/BasicHeaderElementIterator.java | 15 +-
.../org/apache/http/message/TokenParser.java | 13 +-
.../org/apache/http/params/BasicHttpParams.java | 3 +-
.../org/apache/http/pool/AbstractConnPool.java | 25 +-
.../java/org/apache/http/pool/PoolEntry.java | 14 +-
.../org/apache/http/pool/RouteSpecificPool.java | 6 +-
.../apache/http/protocol/HttpCoreContext.java | 8 +-
.../apache/http/protocol/UriPatternMatcher.java | 7 +-
.../java/org/apache/http/util/LangUtils.java | 16 +-
.../http/impl/SessionOutputBufferMock.java | 6 +-
.../impl/io/TimeoutByteArrayInputStream.java | 8 +-
.../java/org/apache/http/pool/TestConnPool.java | 8 +-
.../org/apache/http/pool/TestPoolEntry.java | 8 +-
.../apache/http/ssl/TestSSLContextBuilder.java | 6 +-
.../org/apache/http/testserver/HttpServer.java | 8 +-
.../LoggingBHttpClientConnection.java | 22 +-
.../LoggingBHttpServerConnection.java | 22 +-
109 files changed, 662 insertions(+), 809 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
----------------------------------------------------------------------
diff --git a/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java b/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
index d864c8e..7a07d7f 100644
--- a/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
+++ b/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
@@ -170,18 +170,18 @@ class BenchmarkWorker implements Runnable {
if (charset == null) {
charset = HTTP.DEF_CONTENT_CHARSET;
}
- long contentlen = 0;
+ long contentLen = 0;
final InputStream inStream = entity.getContent();
int l;
while ((l = inStream.read(this.buffer)) != -1) {
- contentlen += l;
+ contentLen += l;
if (config.getVerbosity() >= 4) {
final String s = new String(this.buffer, 0, l, charset);
System.out.print(s);
}
}
inStream.close();
- stats.setContentLength(contentlen);
+ stats.setContentLength(contentLen);
}
if (config.getVerbosity() >= 4) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
index 4a2469c..6d97484 100644
--- a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
+++ b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
@@ -458,9 +458,9 @@ public class NHttpReverseProxy {
}
public void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
synchronized (this.httpExchange) {
- this.httpExchange.setClientIOControl(ioctrl);
+ this.httpExchange.setClientIOControl(ioControl);
// Receive data from the client
final ByteBuffer buf = this.httpExchange.getInBuffer();
final int n = decoder.read(buf);
@@ -471,7 +471,7 @@ public class NHttpReverseProxy {
// If the buffer is full, suspend client input until there is free
// space in the buffer
if (!buf.hasRemaining()) {
- ioctrl.suspendInput();
+ ioControl.suspendInput();
System.out.println("[client->proxy] " + this.httpExchange.getId() + " suspend client input");
}
// If there is some content in the input buffer make sure origin
@@ -550,9 +550,9 @@ public class NHttpReverseProxy {
}
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
synchronized (this.httpExchange) {
- this.httpExchange.setOriginIOControl(ioctrl);
+ this.httpExchange.setOriginIOControl(ioControl);
// Send data to the origin server
final ByteBuffer buf = this.httpExchange.getInBuffer();
buf.flip();
@@ -574,7 +574,7 @@ public class NHttpReverseProxy {
} else {
// Input buffer is empty. Wait until the client fills up
// the buffer
- ioctrl.suspendOutput();
+ ioControl.suspendOutput();
System.out.println("[proxy->origin] " + this.httpExchange.getId() + " suspend origin output");
}
}
@@ -627,9 +627,9 @@ public class NHttpReverseProxy {
}
public void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
synchronized (this.httpExchange) {
- this.httpExchange.setOriginIOControl(ioctrl);
+ this.httpExchange.setOriginIOControl(ioControl);
// Receive data from the origin
final ByteBuffer buf = this.httpExchange.getOutBuffer();
final int n = decoder.read(buf);
@@ -640,7 +640,7 @@ public class NHttpReverseProxy {
// If the buffer is full, suspend origin input until there is free
// space in the buffer
if (!buf.hasRemaining()) {
- ioctrl.suspendInput();
+ ioControl.suspendInput();
System.out.println("[proxy<-origin] " + this.httpExchange.getId() + " suspend origin input");
}
// If there is some content in the input buffer make sure client
@@ -741,9 +741,9 @@ public class NHttpReverseProxy {
}
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
synchronized (this.httpExchange) {
- this.httpExchange.setClientIOControl(ioctrl);
+ this.httpExchange.setClientIOControl(ioControl);
// Send data to the client
final ByteBuffer buf = this.httpExchange.getOutBuffer();
buf.flip();
@@ -765,7 +765,7 @@ public class NHttpReverseProxy {
} else {
// Input buffer is empty. Wait until the origin fills up
// the buffer
- ioctrl.suspendOutput();
+ ioControl.suspendOutput();
System.out.println("[client<-proxy] " + this.httpExchange.getId() + " suspend client output");
}
}
@@ -871,10 +871,10 @@ public class NHttpReverseProxy {
static class ProxyConnPool extends BasicNIOConnPool {
public ProxyConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
final int connectTimeout) {
- super(ioreactor, connFactory, connectTimeout);
+ super(ioReactor, connFactory, connectTimeout);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandlerAdaptor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandlerAdaptor.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandlerAdaptor.java
index 3b355a2..5019400 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandlerAdaptor.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandlerAdaptor.java
@@ -56,8 +56,8 @@ class SSLIOSessionHandlerAdaptor implements org.apache.http.nio.reactor.ssl.SSLS
}
@Override
- public void verify(final IOSession iosession, final SSLSession sslsession) throws SSLException {
- this.handler.verify(iosession.getRemoteAddress(), sslsession);
+ public void verify(final IOSession ioSession, final SSLSession sslsession) throws SSLException {
+ this.handler.verify(ioSession.getRemoteAddress(), sslsession);
}
public void setParams(final HttpParams params) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
index fc867a7..351cb3b 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
@@ -64,11 +64,11 @@ public interface SSLSetupHandler {
* For instance this would be the right place to enforce SSL cipher
* strength, validate certificate chain and do hostname checks.
*
- * @param iosession the underlying IOSession for the SSL connection.
+ * @param ioSession the underlying IOSession for the SSL connection.
* @param sslsession newly created SSL session.
* @throws SSLException if case of SSL protocol error.
*/
- void verify(IOSession iosession, SSLSession sslsession)
+ void verify(IOSession ioSession, SSLSession sslsession)
throws SSLException;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandlerAdaptor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandlerAdaptor.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandlerAdaptor.java
index d49bb8d..480f438 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandlerAdaptor.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandlerAdaptor.java
@@ -56,8 +56,8 @@ class SSLSetupHandlerAdaptor implements org.apache.http.nio.reactor.ssl.SSLSetup
}
@Override
- public void verify(final IOSession iosession, final SSLSession sslsession) throws SSLException {
- this.handler.verify(iosession, sslsession);
+ public void verify(final IOSession ioSession, final SSLSession sslsession) throws SSLException {
+ this.handler.verify(ioSession, sslsession);
}
public void setParams(final HttpParams params) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
index d7d87ab..b404a69 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
@@ -113,20 +113,20 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
return new SSLIOSession(session, sslContext, sslHandler);
}
- protected NHttpClientIOTarget createSSLConnection(final SSLIOSession ssliosession) {
- return super.createConnection(ssliosession);
+ protected NHttpClientIOTarget createSSLConnection(final SSLIOSession sslioSession) {
+ return super.createConnection(sslioSession);
}
@Override
protected NHttpClientIOTarget createConnection(final IOSession session) {
- final SSLIOSession ssliosession = createSSLIOSession(session, this.sslContext, this.sslHandler);
- session.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
- final NHttpClientIOTarget conn = createSSLConnection(ssliosession);
+ final SSLIOSession sslioSession = createSSLIOSession(session, this.sslContext, this.sslHandler);
+ session.setAttribute(SSLIOSession.SESSION_KEY, sslioSession);
+ final NHttpClientIOTarget conn = createSSLConnection(sslioSession);
try {
- ssliosession.initialize();
+ sslioSession.initialize();
} catch (final SSLException ex) {
this.handler.exception(conn, ex);
- ssliosession.shutdown();
+ sslioSession.shutdown();
}
return conn;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
index cf1d413..fa6f004 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
@@ -113,20 +113,20 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
return new SSLIOSession(session, sslContext, sslHandler);
}
- protected NHttpServerIOTarget createSSLConnection(final SSLIOSession ssliosession) {
- return super.createConnection(ssliosession);
+ protected NHttpServerIOTarget createSSLConnection(final SSLIOSession sslioSession) {
+ return super.createConnection(sslioSession);
}
@Override
protected NHttpServerIOTarget createConnection(final IOSession session) {
- final SSLIOSession ssliosession = createSSLIOSession(session, this.sslContext, this.sslHandler);
- session.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
- final NHttpServerIOTarget conn = createSSLConnection(ssliosession);
+ final SSLIOSession sslioSession = createSSLIOSession(session, this.sslContext, this.sslHandler);
+ session.setAttribute(SSLIOSession.SESSION_KEY, sslioSession);
+ final NHttpServerIOTarget conn = createSSLConnection(sslioSession);
try {
- ssliosession.initialize();
+ sslioSession.initialize();
} catch (final SSLException ex) {
this.handler.exception(conn, ex);
- ssliosession.shutdown();
+ sslioSession.shutdown();
}
return conn;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java
index 5c7aa9a..58ce212 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java
@@ -72,7 +72,7 @@ public class BufferingNHttpEntity extends HttpEntityWrapper implements
@Override
public void consumeContent(
final ContentDecoder decoder,
- final IOControl ioctrl) throws IOException {
+ final IOControl ioControl) throws IOException {
this.buffer.consumeContent(decoder);
if (decoder.isCompleted()) {
this.finished = true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
index d7310d1..52f30c9 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
@@ -81,8 +81,8 @@ public class ConsumingNHttpEntityTemplate
@Override
public void consumeContent(
final ContentDecoder decoder,
- final IOControl ioctrl) throws IOException {
- this.contentListener.contentAvailable(decoder, ioctrl);
+ final IOControl ioControl) throws IOException {
+ this.contentListener.contentAvailable(decoder, ioControl);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java
index 8063bee..d19fce3 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java
@@ -46,9 +46,9 @@ public interface ContentListener {
* Notification that content is available to be read from the decoder.
*
* @param decoder content decoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
*/
- void contentAvailable(ContentDecoder decoder, IOControl ioctrl)
+ void contentAvailable(ContentDecoder decoder, IOControl ioControl)
throws IOException;
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java
index eab9604..522298a 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java
@@ -84,7 +84,7 @@ public class NHttpEntityWrapper
@Override
public void produceContent(
final ContentEncoder encoder,
- final IOControl ioctrl) throws IOException {
+ final IOControl ioControl) throws IOException {
final int i = this.channel.read(this.buffer);
this.buffer.flip();
encoder.write(this.buffer);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java
index 1f0fc5c..0b95d8a 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java
@@ -56,7 +56,7 @@ public class SkipContentListener implements ContentListener {
@Override
public void contentAvailable(
final ContentDecoder decoder,
- final IOControl ioctrl) throws IOException {
+ final IOControl ioControl) throws IOException {
int lastRead;
do {
buffer.clear();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
index 0c25d88..d3ef21c 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
@@ -61,7 +61,7 @@ public class BasicAsyncRequestExecutionHandler<T> implements HttpAsyncRequestExe
private final HttpAsyncResponseConsumer<T> responseConsumer;
private final BasicFuture<T> future;
private final HttpContext localContext;
- private final HttpProcessor httppocessor;
+ private final HttpProcessor httpPocessor;
private final ConnectionReuseStrategy reuseStrategy;
private volatile boolean requestSent;
@@ -71,21 +71,21 @@ public class BasicAsyncRequestExecutionHandler<T> implements HttpAsyncRequestExe
final HttpAsyncResponseConsumer<T> responseConsumer,
final FutureCallback<T> callback,
final HttpContext localContext,
- final HttpProcessor httppocessor,
+ final HttpProcessor httpPocessor,
final ConnectionReuseStrategy reuseStrategy,
final HttpParams params) {
super();
Args.notNull(requestProducer, "Request producer");
Args.notNull(responseConsumer, "Response consumer");
Args.notNull(localContext, "HTTP context");
- Args.notNull(httppocessor, "HTTP processor");
+ Args.notNull(httpPocessor, "HTTP processor");
Args.notNull(reuseStrategy, "Connection reuse strategy");
Args.notNull(params, "HTTP parameters");
this.requestProducer = requestProducer;
this.responseConsumer = responseConsumer;
this.future = new BasicFuture<T>(callback);
this.localContext = localContext;
- this.httppocessor = httppocessor;
+ this.httpPocessor = httpPocessor;
this.reuseStrategy = reuseStrategy;
}
@@ -93,10 +93,10 @@ public class BasicAsyncRequestExecutionHandler<T> implements HttpAsyncRequestExe
final HttpAsyncRequestProducer requestProducer,
final HttpAsyncResponseConsumer<T> responseConsumer,
final HttpContext localContext,
- final HttpProcessor httppocessor,
+ final HttpProcessor httpPocessor,
final ConnectionReuseStrategy reuseStrategy,
final HttpParams params) {
- this(requestProducer, responseConsumer, null, localContext, httppocessor, reuseStrategy, params);
+ this(requestProducer, responseConsumer, null, localContext, httpPocessor, reuseStrategy, params);
}
public Future<T> getFuture() {
@@ -134,8 +134,8 @@ public class BasicAsyncRequestExecutionHandler<T> implements HttpAsyncRequestExe
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
- this.requestProducer.produceContent(encoder, ioctrl);
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
+ this.requestProducer.produceContent(encoder, ioControl);
}
@Override
@@ -160,8 +160,8 @@ public class BasicAsyncRequestExecutionHandler<T> implements HttpAsyncRequestExe
@Override
public void consumeContent(
- final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
- this.responseConsumer.consumeContent(decoder, ioctrl);
+ final ContentDecoder decoder, final IOControl ioControl) throws IOException {
+ this.responseConsumer.consumeContent(decoder, ioControl);
}
@Override
@@ -228,7 +228,7 @@ public class BasicAsyncRequestExecutionHandler<T> implements HttpAsyncRequestExe
@Override
public HttpProcessor getHttpProcessor() {
- return this.httppocessor;
+ return this.httpPocessor;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java
index 772827b..70ad47b 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java
@@ -69,7 +69,7 @@ class NullNHttpEntity extends HttpEntityWrapper implements ConsumingNHttpEntity
@Override
public void consumeContent(
final ContentDecoder decoder,
- final IOControl ioctrl) throws IOException {
+ final IOControl ioControl) throws IOException {
int lastRead;
do {
buffer.clear();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
index 4bbab09..cb9bd59 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
@@ -110,9 +110,9 @@ public class DefaultNHttpClientConnection
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
* will be used.
- * @param chardecoder decoder to be used for decoding HTTP protocol elements.
+ * @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.
- * @param charencoder encoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
* @param constraints Message constraints. If {@code null}
* {@link MessageConstraints#DEFAULT} will be used.
@@ -128,14 +128,14 @@ public class DefaultNHttpClientConnection
final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
final NHttpMessageParserFactory<HttpResponse> responseParserFactory) {
- super(session, bufferSize, fragmentSizeHint, allocator, chardecoder, charencoder,
+ super(session, bufferSize, fragmentSizeHint, allocator, charDecoder, charEncoder,
constraints, incomingContentStrategy, outgoingContentStrategy);
this.requestWriter = (requestWriterFactory != null ? requestWriterFactory :
DefaultHttpRequestWriterFactory.INSTANCE).create(this.outbuf);
@@ -149,10 +149,10 @@ public class DefaultNHttpClientConnection
public DefaultNHttpClientConnection(
final IOSession session,
final int bufferSize,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints) {
- this(session, bufferSize, bufferSize, null, chardecoder, charencoder, constraints,
+ this(session, bufferSize, bufferSize, null, charDecoder, charEncoder, constraints,
null, null, null, null);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
index cef68f1..8d7ee6b 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
@@ -110,9 +110,9 @@ public class DefaultNHttpServerConnection
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
* will be used.
- * @param chardecoder decoder to be used for decoding HTTP protocol elements.
+ * @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.
- * @param charencoder encoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
* @param constraints Message constraints. If {@code null}
* {@link MessageConstraints#DEFAULT} will be used.
@@ -132,14 +132,14 @@ public class DefaultNHttpServerConnection
final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory) {
- super(session, bufferSize, fragmentSizeHint, allocator, chardecoder, charencoder,
+ super(session, bufferSize, fragmentSizeHint, allocator, charDecoder, charEncoder,
constraints,
incomingContentStrategy != null ? incomingContentStrategy :
DisallowIdentityContentLengthStrategy.INSTANCE,
@@ -157,10 +157,10 @@ public class DefaultNHttpServerConnection
public DefaultNHttpServerConnection(
final IOSession session,
final int bufferSize,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints) {
- this(session, bufferSize, bufferSize, null, chardecoder, charencoder, constraints,
+ this(session, bufferSize, bufferSize, null, charDecoder, charEncoder, constraints,
null, null, null, null);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpClientEventHandlerAdaptor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpClientEventHandlerAdaptor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpClientEventHandlerAdaptor.java
index 2a1ba75..26c0fa6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpClientEventHandlerAdaptor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpClientEventHandlerAdaptor.java
@@ -89,9 +89,8 @@ class NHttpClientEventHandlerAdaptor implements NHttpClientEventHandler {
} else {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
- } else {
- throw new Error("Unexpected exception: ", ex);
}
+ throw new Error("Unexpected exception: ", ex);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
index a071346..0b1fb05 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
@@ -189,9 +189,9 @@ public class NHttpConnectionBase
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
* will be used.
- * @param chardecoder decoder to be used for decoding HTTP protocol elements.
+ * @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.
- * @param charencoder encoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
* @param constraints Message constraints. If {@code null}
* {@link MessageConstraints#DEFAULT} will be used.
@@ -207,8 +207,8 @@ public class NHttpConnectionBase
final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
@@ -218,8 +218,8 @@ public class NHttpConnectionBase
if (lineBufferSize > 512) {
lineBufferSize = 512;
}
- this.inbuf = new SessionInputBufferImpl(bufferSize, lineBufferSize, chardecoder, allocator);
- this.outbuf = new SessionOutputBufferImpl(bufferSize, lineBufferSize, charencoder, allocator);
+ this.inbuf = new SessionInputBufferImpl(bufferSize, lineBufferSize, charDecoder, allocator);
+ this.outbuf = new SessionOutputBufferImpl(bufferSize, lineBufferSize, charEncoder, allocator);
this.fragmentSizeHint = fragmentSizeHint >= 0 ? fragmentSizeHint : bufferSize;
this.inTransportMetrics = new HttpTransportMetricsImpl();
@@ -244,9 +244,9 @@ public class NHttpConnectionBase
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
* will be used.
- * @param chardecoder decoder to be used for decoding HTTP protocol elements.
+ * @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.
- * @param charencoder encoder to be used for encoding HTTP protocol elements.
+ * @param charEncoder encoder to be used for encoding HTTP protocol elements.
* If {@code null} simple type cast will be used for char to byte conversion.
* @param incomingContentStrategy incoming content length strategy. If {@code null}
* {@link LaxContentLengthStrategy#INSTANCE} will be used.
@@ -260,11 +260,11 @@ public class NHttpConnectionBase
final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
- final CharsetDecoder chardecoder,
- final CharsetEncoder charencoder,
+ final CharsetDecoder charDecoder,
+ final CharsetEncoder charEncoder,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
- this(session, bufferSize, fragmentSizeHint, allocator, chardecoder, charencoder,
+ this(session, bufferSize, fragmentSizeHint, allocator, charDecoder, charEncoder,
null, incomingContentStrategy, outgoingContentStrategy);
}
@@ -526,41 +526,25 @@ public class NHttpConnectionBase
@Override
public InetAddress getLocalAddress() {
final SocketAddress address = this.session.getLocalAddress();
- if (address instanceof InetSocketAddress) {
- return ((InetSocketAddress) address).getAddress();
- } else {
- return null;
- }
+ return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getAddress() : null;
}
@Override
public int getLocalPort() {
final SocketAddress address = this.session.getLocalAddress();
- if (address instanceof InetSocketAddress) {
- return ((InetSocketAddress) address).getPort();
- } else {
- return -1;
- }
+ return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getPort() : -1;
}
@Override
public InetAddress getRemoteAddress() {
final SocketAddress address = this.session.getRemoteAddress();
- if (address instanceof InetSocketAddress) {
- return ((InetSocketAddress) address).getAddress();
- } else {
- return null;
- }
+ return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getAddress() : null;
}
@Override
public int getRemotePort() {
final SocketAddress address = this.session.getRemoteAddress();
- if (address instanceof InetSocketAddress) {
- return ((InetSocketAddress) address).getPort();
- } else {
- return -1;
- }
+ return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getPort() : -1;
}
@Override
@@ -594,18 +578,13 @@ public class NHttpConnectionBase
buffer.append("<->");
NetUtils.formatAddress(buffer, remoteAddress);
return buffer.toString();
- } else {
- return "[Not bound]";
}
+ return "[Not bound]";
}
@Override
public Socket getSocket() {
- if (this.session instanceof SocketAccessor) {
- return ((SocketAccessor) this.session).getSocket();
- } else {
- return null;
- }
+ return this.session instanceof SocketAccessor ? ((SocketAccessor) this.session).getSocket() : null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpServerEventHandlerAdaptor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpServerEventHandlerAdaptor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpServerEventHandlerAdaptor.java
index a5b182e..28615c2 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpServerEventHandlerAdaptor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpServerEventHandlerAdaptor.java
@@ -89,9 +89,8 @@ class NHttpServerEventHandlerAdaptor implements NHttpServerEventHandler {
} else {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
- } else {
- throw new Error("Unexpected exception: ", ex);
}
+ throw new Error("Unexpected exception: ", ex);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
index 93d7bfe..6573c46 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
@@ -215,21 +215,21 @@ public class SSLNHttpClientConnectionFactory
* @since 4.3
*/
protected SSLIOSession createSSLIOSession(
- final IOSession iosession,
+ final IOSession ioSession,
final SSLContext sslContext,
final SSLSetupHandler sslHandler) {
- final Object attachment = iosession.getAttribute(IOSession.ATTACHMENT_KEY);
- return new SSLIOSession(iosession, SSLMode.CLIENT,
+ final Object attachment = ioSession.getAttribute(IOSession.ATTACHMENT_KEY);
+ return new SSLIOSession(ioSession, SSLMode.CLIENT,
attachment instanceof HttpHost ? (HttpHost) attachment : null,
sslContext, sslHandler);
}
@Override
- public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
- final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslContext, this.sslHandler);
- iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
+ public DefaultNHttpClientConnection createConnection(final IOSession ioSession) {
+ final SSLIOSession sslioSession = createSSLIOSession(ioSession, this.sslContext, this.sslHandler);
+ ioSession.setAttribute(SSLIOSession.SESSION_KEY, sslioSession);
return new DefaultNHttpClientConnection(
- ssliosession,
+ sslioSession,
this.cconfig.getBufferSize(),
this.cconfig.getFragmentSizeHint(),
this.allocator,
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
index 294f8af..74cab17 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
@@ -212,19 +212,19 @@ public class SSLNHttpServerConnectionFactory
* @since 4.3
*/
protected SSLIOSession createSSLIOSession(
- final IOSession iosession,
+ final IOSession ioSession,
final SSLContext sslContext,
final SSLSetupHandler sslHandler) {
- final SSLIOSession ssliosession = new SSLIOSession(iosession, SSLMode.SERVER,
+ final SSLIOSession sslioSession = new SSLIOSession(ioSession, SSLMode.SERVER,
sslContext, sslHandler);
- return ssliosession;
+ return sslioSession;
}
@Override
- public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
- final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslContext, this.sslHandler);
- iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
- return new DefaultNHttpServerConnection(ssliosession,
+ public DefaultNHttpServerConnection createConnection(final IOSession ioSession) {
+ final SSLIOSession sslioSession = createSSLIOSession(ioSession, this.sslContext, this.sslHandler);
+ ioSession.setAttribute(SSLIOSession.SESSION_KEY, sslioSession);
+ return new DefaultNHttpServerConnection(sslioSession,
this.cconfig.getBufferSize(),
this.cconfig.getFragmentSizeHint(),
this.allocator,
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
index 21b6ed6..d31cc72 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
@@ -32,26 +32,26 @@ import org.apache.http.protocol.HttpContext;
class SessionHttpContext implements HttpContext {
- private final IOSession iosession;
+ private final IOSession ioSession;
- public SessionHttpContext(final IOSession iosession) {
+ public SessionHttpContext(final IOSession ioSession) {
super();
- this.iosession = iosession;
+ this.ioSession = ioSession;
}
@Override
public Object getAttribute(final String id) {
- return this.iosession.getAttribute(id);
+ return this.ioSession.getAttribute(id);
}
@Override
public Object removeAttribute(final String id) {
- return this.iosession.removeAttribute(id);
+ return this.ioSession.removeAttribute(id);
}
@Override
public void setAttribute(final String id, final Object obj) {
- this.iosession.setAttribute(id, obj);
+ this.ioSession.setAttribute(id, obj);
}
/**
@@ -60,8 +60,8 @@ class SessionHttpContext implements HttpContext {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
- sb.append("[iosession=");
- sb.append(iosession);
+ sb.append("[ioSession=");
+ sb.append(ioSession);
sb.append("]");
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
index 0e0f8d9..4a586d7 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
@@ -173,11 +173,10 @@ public abstract class AbstractContentEncoder implements ContentEncoder {
this.metrics.incrementBytesTransferred(bytesWritten);
}
return bytesWritten;
- } else {
- final int chunk = src.remaining();
- this.buffer.write(src);
- return chunk;
}
+ final int chunk = src.remaining();
+ this.buffer.write(src);
+ return chunk;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
index 3808984..8142d90 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
@@ -236,9 +236,8 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements NH
}
}
return this.message;
- } else {
- return null;
}
+ return null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
index 6cd8adb..81a332e 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
@@ -270,11 +270,7 @@ public class ChunkDecoder extends AbstractContentDecoder {
}
public Header[] getFooters() {
- if (this.footers != null) {
- return this.footers.clone();
- } else {
- return new Header[] {};
- }
+ return this.footers != null ? this.footers.clone() : new Header[] {};
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
index 2cf6f46..654af97 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
@@ -92,10 +92,10 @@ public class BasicNIOConnPool extends AbstractNIOConnPool<HttpHost, NHttpClientC
*/
@Deprecated
public BasicNIOConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
final HttpParams params) {
- super(ioreactor, connFactory, 2, 20);
+ super(ioReactor, connFactory, 2, 20);
Args.notNull(params, "HTTP parameters");
this.connectTimeout = params.getIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 0);
}
@@ -106,18 +106,18 @@ public class BasicNIOConnPool extends AbstractNIOConnPool<HttpHost, NHttpClientC
*/
@Deprecated
public BasicNIOConnPool(
- final ConnectingIOReactor ioreactor, final HttpParams params) {
- this(ioreactor, new BasicNIOConnFactory(params), params);
+ final ConnectingIOReactor ioReactor, final HttpParams params) {
+ this(ioReactor, new BasicNIOConnFactory(params), params);
}
/**
* @since 4.3
*/
public BasicNIOConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
final int connectTimeout) {
- super(ioreactor, connFactory, new BasicAddressResolver(), 2, 20);
+ super(ioReactor, connFactory, new BasicAddressResolver(), 2, 20);
this.connectTimeout = connectTimeout;
}
@@ -125,26 +125,26 @@ public class BasicNIOConnPool extends AbstractNIOConnPool<HttpHost, NHttpClientC
* @since 4.3
*/
public BasicNIOConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final int connectTimeout,
final ConnectionConfig config) {
- this(ioreactor, new BasicNIOConnFactory(config), connectTimeout);
+ this(ioReactor, new BasicNIOConnFactory(config), connectTimeout);
}
/**
* @since 4.3
*/
public BasicNIOConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final ConnectionConfig config) {
- this(ioreactor, new BasicNIOConnFactory(config), 0);
+ this(ioReactor, new BasicNIOConnFactory(config), 0);
}
/**
* @since 4.3
*/
- public BasicNIOConnPool(final ConnectingIOReactor ioreactor) {
- this(ioreactor, new BasicNIOConnFactory(ConnectionConfig.DEFAULT), 0);
+ public BasicNIOConnPool(final ConnectingIOReactor ioReactor) {
+ this(ioReactor, new BasicNIOConnFactory(ConnectionConfig.DEFAULT), 0);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIODispatch.java
index a0fbb87..0326771 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIODispatch.java
@@ -71,18 +71,18 @@ public abstract class AbstractIODispatch<T> implements IOEventDispatch {
session.setAttribute(IOEventDispatch.CONNECTION_KEY, conn);
}
onConnected(conn);
- final SSLIOSession ssliosession = (SSLIOSession) session.getAttribute(
+ final SSLIOSession sslioSession = (SSLIOSession) session.getAttribute(
SSLIOSession.SESSION_KEY);
- if (ssliosession != null) {
+ if (sslioSession != null) {
try {
- synchronized (ssliosession) {
- if (!ssliosession.isInitialized()) {
- ssliosession.initialize();
+ synchronized (sslioSession) {
+ if (!sslioSession.isInitialized()) {
+ sslioSession.initialize();
}
}
} catch (final IOException ex) {
onException(conn, ex);
- ssliosession.shutdown();
+ sslioSession.shutdown();
}
}
} catch (final RuntimeException ex) {
@@ -108,22 +108,22 @@ public abstract class AbstractIODispatch<T> implements IOEventDispatch {
T conn = (T) session.getAttribute(IOEventDispatch.CONNECTION_KEY);
try {
ensureNotNull(conn);
- final SSLIOSession ssliosession = (SSLIOSession) session.getAttribute(
+ final SSLIOSession sslioSession = (SSLIOSession) session.getAttribute(
SSLIOSession.SESSION_KEY);
- if (ssliosession == null) {
+ if (sslioSession == null) {
onInputReady(conn);
} else {
try {
- if (!ssliosession.isInitialized()) {
- ssliosession.initialize();
+ if (!sslioSession.isInitialized()) {
+ sslioSession.initialize();
}
- if (ssliosession.isAppInputReady()) {
+ if (sslioSession.isAppInputReady()) {
onInputReady(conn);
}
- ssliosession.inboundTransport();
+ sslioSession.inboundTransport();
} catch (final IOException ex) {
onException(conn, ex);
- ssliosession.shutdown();
+ sslioSession.shutdown();
}
}
} catch (final RuntimeException ex) {
@@ -139,22 +139,22 @@ public abstract class AbstractIODispatch<T> implements IOEventDispatch {
T conn = (T) session.getAttribute(IOEventDispatch.CONNECTION_KEY);
try {
ensureNotNull(conn);
- final SSLIOSession ssliosession = (SSLIOSession) session.getAttribute(
+ final SSLIOSession sslioSession = (SSLIOSession) session.getAttribute(
SSLIOSession.SESSION_KEY);
- if (ssliosession == null) {
+ if (sslioSession == null) {
onOutputReady(conn);
} else {
try {
- if (!ssliosession.isInitialized()) {
- ssliosession.initialize();
+ if (!sslioSession.isInitialized()) {
+ sslioSession.initialize();
}
- if (ssliosession.isAppOutputReady()) {
+ if (sslioSession.isAppOutputReady()) {
onOutputReady(conn);
}
- ssliosession.outboundTransport();
+ sslioSession.outboundTransport();
} catch (final IOException ex) {
onException(conn, ex);
- ssliosession.shutdown();
+ sslioSession.shutdown();
}
}
} catch (final RuntimeException ex) {
@@ -169,15 +169,15 @@ public abstract class AbstractIODispatch<T> implements IOEventDispatch {
final
T conn = (T) session.getAttribute(IOEventDispatch.CONNECTION_KEY);
try {
- final SSLIOSession ssliosession = (SSLIOSession) session.getAttribute(
+ final SSLIOSession sslioSession = (SSLIOSession) session.getAttribute(
SSLIOSession.SESSION_KEY);
ensureNotNull(conn);
onTimeout(conn);
- if (ssliosession != null) {
- synchronized (ssliosession) {
- if (ssliosession.isOutboundDone() && !ssliosession.isInboundDone()) {
+ if (sslioSession != null) {
+ synchronized (sslioSession) {
+ if (sslioSession.isOutboundDone() && !sslioSession.isInboundDone()) {
// The session failed to terminate cleanly
- ssliosession.shutdown();
+ sslioSession.shutdown();
}
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
index c0ef698..7808cf5 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
@@ -85,11 +85,7 @@ public class ChannelEntry {
* {@code null} otherwise.
*/
public Object getAttachment() {
- if (this.sessionRequest != null) {
- return this.sessionRequest.getAttachment();
- } else {
- return null;
- }
+ return this.sessionRequest != null ? this.sessionRequest.getAttachment() : null;
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
index f4d4819..bfc8de7 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
@@ -247,9 +247,8 @@ public class DefaultListeningIOReactor extends AbstractMultiworkerIOReactor
if (this.exceptionHandler == null || !this.exceptionHandler.handle(ex)) {
throw new IOReactorException("Failure binding socket to address "
+ address, ex);
- } else {
- return;
}
+ return;
}
try {
final SelectionKey key = serverChannel.register(this.selector, SelectionKey.OP_ACCEPT);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
index 57419a5..01c8a8f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
@@ -119,20 +119,16 @@ public class IOSessionImpl implements IOSession, SocketAccessor {
@Override
public SocketAddress getLocalAddress() {
- if (this.channel instanceof SocketChannel) {
- return ((SocketChannel)this.channel).socket().getLocalSocketAddress();
- } else {
- return null;
- }
+ return this.channel instanceof SocketChannel
+ ? ((SocketChannel) this.channel).socket().getLocalSocketAddress()
+ : null;
}
@Override
public SocketAddress getRemoteAddress() {
- if (this.channel instanceof SocketChannel) {
- return ((SocketChannel)this.channel).socket().getRemoteSocketAddress();
- } else {
- return null;
- }
+ return this.channel instanceof SocketChannel
+ ? ((SocketChannel) this.channel).socket().getRemoteSocketAddress()
+ : null;
}
@Override
@@ -379,11 +375,7 @@ public class IOSessionImpl implements IOSession, SocketAccessor {
@Override
public Socket getSocket() {
- if (this.channel instanceof SocketChannel) {
- return ((SocketChannel) this.channel).socket();
- } else {
- return null;
- }
+ return this.channel instanceof SocketChannel ? ((SocketChannel) this.channel).socket() : null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
index d41682a..2938703 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
@@ -62,12 +62,7 @@ class InterestOpEntry {
if (this == obj) {
return true;
}
- if (obj instanceof InterestOpEntry) {
- final InterestOpEntry that = (InterestOpEntry) obj;
- return this.key.equals(that.key);
- } else {
- return false;
- }
+ return obj instanceof InterestOpEntry ? this.key.equals(((InterestOpEntry) obj).key) : false;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java
index ff10764..e5a4ed4 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntity.java
@@ -53,9 +53,9 @@ public interface ConsumingNHttpEntity extends HttpEntity {
* allocate more storage to accommodate all incoming content.
*
* @param decoder content decoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
*/
- void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException;
+ void consumeContent(ContentDecoder decoder, IOControl ioControl) throws IOException;
/**
* Notification that any resources allocated for reading can be released.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentInputStream.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentInputStream.java
index 25f628c..0f9e201 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentInputStream.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentInputStream.java
@@ -51,11 +51,7 @@ public class ContentInputStream extends InputStream {
@Override
public int available() throws IOException {
- if (this.buffer instanceof BufferInfo) {
- return ((BufferInfo) this.buffer).length();
- } else {
- return super.available();
- }
+ return this.buffer instanceof BufferInfo ? ((BufferInfo) this.buffer).length() : super.available();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java
index a1445bb..32575d1 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java
@@ -60,7 +60,7 @@ public class EntityAsyncContentProducer implements HttpAsyncContentProducer {
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
if (this.channel == null) {
this.channel = Channels.newChannel(this.entity.getContent());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/HttpAsyncContentProducer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/HttpAsyncContentProducer.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/HttpAsyncContentProducer.java
index 93bcbdb..600a252 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/HttpAsyncContentProducer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/HttpAsyncContentProducer.java
@@ -56,9 +56,9 @@ public interface HttpAsyncContentProducer extends Closeable {
* to resume output event notifications when more content is made available.
*
* @param encoder content encoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
*/
- void produceContent(ContentEncoder encoder, IOControl ioctrl) throws IOException;
+ void produceContent(ContentEncoder encoder, IOControl ioControl) throws IOException;
/**
* Determines whether or not this producer is capable of producing
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java
index 79749c0..442c8e9 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java
@@ -131,7 +131,7 @@ public class NByteArrayEntity extends AbstractHttpEntity
}
@Override
- public void produceContent(final ContentEncoder encoder, final IOControl ioctrl)
+ public void produceContent(final ContentEncoder encoder, final IOControl ioControl)
throws IOException {
encoder.write(this.buf);
if(!this.buf.hasRemaining()) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/NFileEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NFileEntity.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/NFileEntity.java
index 29d9a22..9f1c9fa 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NFileEntity.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/NFileEntity.java
@@ -158,7 +158,7 @@ public class NFileEntity extends AbstractHttpEntity
}
@Override
- public void produceContent(final ContentEncoder encoder, final IOControl ioctrl)
+ public void produceContent(final ContentEncoder encoder, final IOControl ioControl)
throws IOException {
if (accessfile == null) {
accessfile = new RandomAccessFile(this.file, "r");
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java
index d19ffb1..43b42d7 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java
@@ -171,7 +171,7 @@ public class NStringEntity extends AbstractHttpEntity
@Override
public void produceContent(
- final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
+ final ContentEncoder encoder, final IOControl ioControl) throws IOException {
encoder.write(this.buf);
if (!this.buf.hasRemaining()) {
encoder.complete();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java
index 44579f1..dbdf3bb 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ProducingNHttpEntity.java
@@ -56,9 +56,9 @@ public interface ProducingNHttpEntity extends HttpEntity {
* Failure to do so could result in the entity never being written.
*
* @param encoder content encoder.
- * @param ioctrl I/O control of the underlying connection.
+ * @param ioControl I/O control of the underlying connection.
*/
- void produceContent(ContentEncoder encoder, IOControl ioctrl) throws IOException;
+ void produceContent(ContentEncoder encoder, IOControl ioControl) throws IOException;
/**
* Notification that any resources allocated for writing can be released.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
index 179aea5..1bddff6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -75,7 +75,7 @@ import org.apache.http.util.LangUtils;
public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
implements ConnPool<T, E>, ConnPoolControl<T> {
- private final ConnectingIOReactor ioreactor;
+ private final ConnectingIOReactor ioReactor;
private final NIOConnFactory<T, C> connFactory;
private final SocketAddressResolver<T> addressResolver;
private final SessionRequestCallback sessionRequestCallback;
@@ -98,16 +98,16 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
*/
@Deprecated
public AbstractNIOConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final NIOConnFactory<T, C> connFactory,
final int defaultMaxPerRoute,
final int maxTotal) {
super();
- Args.notNull(ioreactor, "I/O reactor");
+ Args.notNull(ioReactor, "I/O reactor");
Args.notNull(connFactory, "Connection factory");
Args.positive(defaultMaxPerRoute, "Max per route value");
Args.positive(maxTotal, "Max total value");
- this.ioreactor = ioreactor;
+ this.ioReactor = ioReactor;
this.connFactory = connFactory;
this.addressResolver = new SocketAddressResolver<T>() {
@@ -140,18 +140,18 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
* @since 4.3
*/
public AbstractNIOConnPool(
- final ConnectingIOReactor ioreactor,
+ final ConnectingIOReactor ioReactor,
final NIOConnFactory<T, C> connFactory,
final SocketAddressResolver<T> addressResolver,
final int defaultMaxPerRoute,
final int maxTotal) {
super();
- Args.notNull(ioreactor, "I/O reactor");
+ Args.notNull(ioReactor, "I/O reactor");
Args.notNull(connFactory, "Connection factory");
Args.notNull(addressResolver, "Address resolver");
Args.positive(defaultMaxPerRoute, "Max per route value");
Args.positive(maxTotal, "Max total value");
- this.ioreactor = ioreactor;
+ this.ioReactor = ioReactor;
this.connFactory = connFactory;
this.addressResolver = addressResolver;
this.sessionRequestCallback = new InternalSessionRequestCallback();
@@ -230,7 +230,7 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
this.pending.clear();
this.available.clear();
this.leasingRequests.clear();
- this.ioreactor.shutdown(waitMs);
+ this.ioReactor.shutdown(waitMs);
} finally {
this.lock.unlock();
}
@@ -255,9 +255,9 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
public Future<E> lease(
final T route, final Object state,
- final long connectTimeout, final TimeUnit tunit,
+ final long connectTimeout, final TimeUnit timeUnit,
final FutureCallback<E> callback) {
- return this.lease(route, state, connectTimeout, connectTimeout, tunit, callback);
+ return this.lease(route, state, connectTimeout, connectTimeout, timeUnit, callback);
}
/**
@@ -265,15 +265,15 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
*/
public Future<E> lease(
final T route, final Object state,
- final long connectTimeout, final long leaseTimeout, final TimeUnit tunit,
+ final long connectTimeout, final long leaseTimeout, final TimeUnit timeUnit,
final FutureCallback<E> callback) {
Args.notNull(route, "Route");
- Args.notNull(tunit, "Time unit");
+ Args.notNull(timeUnit, "Time unit");
Asserts.check(!this.isShutDown.get(), "Connection pool shut down");
final BasicFuture<E> future = new BasicFuture<E>(callback);
final LeaseRequest<T, C, E> leaseRequest = new LeaseRequest<T, C, E>(route, state,
- connectTimeout >= 0 ? tunit.toMillis(connectTimeout) : -1,
- leaseTimeout > 0 ? tunit.toMillis(leaseTimeout) : 0,
+ connectTimeout >= 0 ? timeUnit.toMillis(connectTimeout) : -1,
+ leaseTimeout > 0 ? timeUnit.toMillis(leaseTimeout) : 0,
future);
this.lock.lock();
try {
@@ -478,7 +478,7 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
return false;
}
- final SessionRequest sessionRequest = this.ioreactor.connect(
+ final SessionRequest sessionRequest = this.ioReactor.connect(
remoteAddress, localAddress, route, this.sessionRequestCallback);
request.attachSessionRequest(sessionRequest);
final long connectTimeout = request.getConnectTimeout();
@@ -488,9 +488,8 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
this.pending.add(sessionRequest);
pool.addPending(sessionRequest, request.getFuture());
return true;
- } else {
- return false;
}
+ return false;
}
private void fireCallbacks() {
@@ -562,7 +561,7 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
onLease(entry);
} else {
this.available.add(entry);
- if (this.ioreactor.getStatus().compareTo(IOReactorStatus.ACTIVE) <= 0) {
+ if (this.ioReactor.getStatus().compareTo(IOReactorStatus.ACTIVE) <= 0) {
processNextPendingRequest();
}
}
@@ -587,7 +586,7 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
this.pending.remove(request);
final RouteSpecificPool<T, C, E> pool = getPool(route);
pool.cancelled(request);
- if (this.ioreactor.getStatus().compareTo(IOReactorStatus.ACTIVE) <= 0) {
+ if (this.ioReactor.getStatus().compareTo(IOReactorStatus.ACTIVE) <= 0) {
processNextPendingRequest();
}
} finally {
@@ -636,11 +635,7 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
private int getMax(final T route) {
final Integer v = this.maxPerRoute.get(route);
- if (v != null) {
- return v.intValue();
- } else {
- return this.defaultMaxPerRoute;
- }
+ return v != null ? v.intValue() : this.defaultMaxPerRoute;
}
@Override
@@ -831,9 +826,9 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
}
}
- public void closeIdle(final long idletime, final TimeUnit tunit) {
- Args.notNull(tunit, "Time unit");
- long time = tunit.toMillis(idletime);
+ public void closeIdle(final long idletime, final TimeUnit timeUnit) {
+ Args.notNull(timeUnit, "Time unit");
+ long time = timeUnit.toMillis(idletime);
if (time < 0) {
time = 0;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/07a4acf7/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
index 1642d17..d58dca3 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
@@ -104,11 +104,7 @@ abstract class RouteSpecificPool<T, C, E extends PoolEntry<T, C>> {
}
public E getLastUsed() {
- if (!this.available.isEmpty()) {
- return this.available.getLast();
- } else {
- return null;
- }
+ return this.available.isEmpty() ? null : this.available.getLast();
}
public boolean remove(final E entry) {
@@ -148,10 +144,9 @@ abstract class RouteSpecificPool<T, C, E extends PoolEntry<T, C>> {
final BasicFuture<E> future = removeRequest(request);
if (future != null) {
return future.completed(entry);
- } else {
- request.cancel();
- return false;
}
+ request.cancel();
+ return false;
}
public void cancelled(final SessionRequest request) {