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 2013/01/15 21:08:11 UTC
svn commit: r1433610 [2/2] - in /httpcomponents/httpclient/trunk:
httpclient-cache/src/main/java/org/apache/http/impl/client/cache/
httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/
httpclient-cache/src/test/java/org/apache/ht...
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java Tue Jan 15 20:08:10 2013
@@ -186,8 +186,8 @@ final class NTLMEngineImpl implements NT
private static String stripDotSuffix(final String value) {
int index = value.indexOf(".");
if (index != -1) {
- return value.substring(0, index);
- }
+ return value.substring(0, index);
+ }
return value;
}
@@ -203,16 +203,16 @@ final class NTLMEngineImpl implements NT
private static int readULong(final byte[] src, final int index) throws NTLMEngineException {
if (src.length < index + 4) {
- throw new NTLMEngineException("NTLM authentication - buffer too small for DWORD");
- }
+ throw new NTLMEngineException("NTLM authentication - buffer too small for DWORD");
+ }
return (src[index] & 0xff) | ((src[index + 1] & 0xff) << 8)
| ((src[index + 2] & 0xff) << 16) | ((src[index + 3] & 0xff) << 24);
}
private static int readUShort(final byte[] src, final int index) throws NTLMEngineException {
if (src.length < index + 2) {
- throw new NTLMEngineException("NTLM authentication - buffer too small for WORD");
- }
+ throw new NTLMEngineException("NTLM authentication - buffer too small for WORD");
+ }
return (src[index] & 0xff) | ((src[index + 1] & 0xff) << 8);
}
@@ -220,9 +220,9 @@ final class NTLMEngineImpl implements NT
int length = readUShort(src, index);
int offset = readULong(src, index + 4);
if (src.length < offset + length) {
- throw new NTLMEngineException(
+ throw new NTLMEngineException(
"NTLM authentication - buffer too small for data item");
- }
+ }
byte[] buffer = new byte[length];
System.arraycopy(src, offset, buffer, 0, length);
return buffer;
@@ -304,8 +304,8 @@ final class NTLMEngineImpl implements NT
public byte[] getClientChallenge()
throws NTLMEngineException {
if (clientChallenge == null) {
- clientChallenge = makeRandomChallenge();
- }
+ clientChallenge = makeRandomChallenge();
+ }
return clientChallenge;
}
@@ -313,8 +313,8 @@ final class NTLMEngineImpl implements NT
public byte[] getSecondaryKey()
throws NTLMEngineException {
if (secondaryKey == null) {
- secondaryKey = makeSecondaryKey();
- }
+ secondaryKey = makeSecondaryKey();
+ }
return secondaryKey;
}
@@ -322,8 +322,8 @@ final class NTLMEngineImpl implements NT
public byte[] getLMHash()
throws NTLMEngineException {
if (lmHash == null) {
- lmHash = lmHash(password);
- }
+ lmHash = lmHash(password);
+ }
return lmHash;
}
@@ -331,8 +331,8 @@ final class NTLMEngineImpl implements NT
public byte[] getLMResponse()
throws NTLMEngineException {
if (lmResponse == null) {
- lmResponse = lmResponse(getLMHash(),challenge);
- }
+ lmResponse = lmResponse(getLMHash(),challenge);
+ }
return lmResponse;
}
@@ -340,8 +340,8 @@ final class NTLMEngineImpl implements NT
public byte[] getNTLMHash()
throws NTLMEngineException {
if (ntlmHash == null) {
- ntlmHash = ntlmHash(password);
- }
+ ntlmHash = ntlmHash(password);
+ }
return ntlmHash;
}
@@ -349,8 +349,8 @@ final class NTLMEngineImpl implements NT
public byte[] getNTLMResponse()
throws NTLMEngineException {
if (ntlmResponse == null) {
- ntlmResponse = lmResponse(getNTLMHash(),challenge);
- }
+ ntlmResponse = lmResponse(getNTLMHash(),challenge);
+ }
return ntlmResponse;
}
@@ -358,8 +358,8 @@ final class NTLMEngineImpl implements NT
public byte[] getNTLMv2Hash()
throws NTLMEngineException {
if (ntlmv2Hash == null) {
- ntlmv2Hash = ntlmv2Hash(target, user, password);
- }
+ ntlmv2Hash = ntlmv2Hash(target, user, password);
+ }
return ntlmv2Hash;
}
@@ -383,8 +383,8 @@ final class NTLMEngineImpl implements NT
public byte[] getNTLMv2Blob()
throws NTLMEngineException {
if (ntlmv2Blob == null) {
- ntlmv2Blob = createBlob(getClientChallenge(), targetInformation, getTimestamp());
- }
+ ntlmv2Blob = createBlob(getClientChallenge(), targetInformation, getTimestamp());
+ }
return ntlmv2Blob;
}
@@ -392,8 +392,8 @@ final class NTLMEngineImpl implements NT
public byte[] getNTLMv2Response()
throws NTLMEngineException {
if (ntlmv2Response == null) {
- ntlmv2Response = lmv2Response(getNTLMv2Hash(),challenge,getNTLMv2Blob());
- }
+ ntlmv2Response = lmv2Response(getNTLMv2Hash(),challenge,getNTLMv2Blob());
+ }
return ntlmv2Response;
}
@@ -401,8 +401,8 @@ final class NTLMEngineImpl implements NT
public byte[] getLMv2Response()
throws NTLMEngineException {
if (lmv2Response == null) {
- lmv2Response = lmv2Response(getNTLMv2Hash(),challenge,getClientChallenge());
- }
+ lmv2Response = lmv2Response(getNTLMv2Hash(),challenge,getClientChallenge());
+ }
return lmv2Response;
}
@@ -410,8 +410,8 @@ final class NTLMEngineImpl implements NT
public byte[] getNTLM2SessionResponse()
throws NTLMEngineException {
if (ntlm2SessionResponse == null) {
- ntlm2SessionResponse = ntlm2SessionResponse(getNTLMHash(),challenge,getClientChallenge());
- }
+ ntlm2SessionResponse = ntlm2SessionResponse(getNTLMHash(),challenge,getClientChallenge());
+ }
return ntlm2SessionResponse;
}
@@ -573,8 +573,8 @@ final class NTLMEngineImpl implements NT
return lmResponse(ntlmHash, sessionHash);
} catch (Exception e) {
if (e instanceof NTLMEngineException) {
- throw (NTLMEngineException) e;
- }
+ throw (NTLMEngineException) e;
+ }
throw new NTLMEngineException(e.getMessage(), e);
}
}
@@ -819,23 +819,23 @@ final class NTLMEngineImpl implements NT
DEFAULT_CHARSET));
// Look for NTLM message
if (messageContents.length < SIGNATURE.length) {
- throw new NTLMEngineException("NTLM message decoding error - packet too short");
- }
+ throw new NTLMEngineException("NTLM message decoding error - packet too short");
+ }
int i = 0;
while (i < SIGNATURE.length) {
if (messageContents[i] != SIGNATURE[i]) {
- throw new NTLMEngineException(
+ throw new NTLMEngineException(
"NTLM message expected - instead got unrecognized bytes");
- }
+ }
i++;
}
// Check to be sure there's a type 2 message indicator next
int type = readULong(SIGNATURE.length);
if (type != expectedType) {
- throw new NTLMEngineException("NTLM type " + Integer.toString(expectedType)
+ throw new NTLMEngineException("NTLM type " + Integer.toString(expectedType)
+ " message expected - instead got type " + Integer.toString(type));
- }
+ }
currentOutputPosition = messageContents.length;
}
@@ -856,16 +856,16 @@ final class NTLMEngineImpl implements NT
/** Read a byte from a position within the message buffer */
protected byte readByte(final int position) throws NTLMEngineException {
if (messageContents.length < position + 1) {
- throw new NTLMEngineException("NTLM: Message too short");
- }
+ throw new NTLMEngineException("NTLM: Message too short");
+ }
return messageContents[position];
}
/** Read a bunch of bytes from a position in the message buffer */
protected void readBytes(final byte[] buffer, final int position) throws NTLMEngineException {
if (messageContents.length < position + buffer.length) {
- throw new NTLMEngineException("NTLM: Message too short");
- }
+ throw new NTLMEngineException("NTLM: Message too short");
+ }
System.arraycopy(messageContents, position, buffer, 0, buffer.length);
}
@@ -1084,10 +1084,10 @@ final class NTLMEngineImpl implements NT
flags = readULong(20);
if ((flags & FLAG_REQUEST_UNICODE_ENCODING) == 0) {
- throw new NTLMEngineException(
+ throw new NTLMEngineException(
"NTLM type 2 message has flags that make no sense: "
+ Integer.toString(flags));
- }
+ }
// Do the target!
target = null;
@@ -1179,10 +1179,10 @@ final class NTLMEngineImpl implements NT
ntResp = gen.getNTLMv2Response();
lmResp = gen.getLMv2Response();
if ((type2Flags & FLAG_REQUEST_LAN_MANAGER_KEY) != 0) {
- userSessionKey = gen.getLanManagerSessionKey();
- } else {
- userSessionKey = gen.getNTLMv2UserSessionKey();
- }
+ userSessionKey = gen.getLanManagerSessionKey();
+ } else {
+ userSessionKey = gen.getNTLMv2UserSessionKey();
+ }
} else {
// NTLMv1
if ((type2Flags & FLAG_REQUEST_NTLM2_SESSION) != 0) {
@@ -1190,23 +1190,23 @@ final class NTLMEngineImpl implements NT
ntResp = gen.getNTLM2SessionResponse();
lmResp = gen.getLM2SessionResponse();
if ((type2Flags & FLAG_REQUEST_LAN_MANAGER_KEY) != 0) {
- userSessionKey = gen.getLanManagerSessionKey();
- }
- else {
- userSessionKey = gen.getNTLM2SessionResponseUserSessionKey();
+ userSessionKey = gen.getLanManagerSessionKey();
+ }
+ else {
+ userSessionKey = gen.getNTLM2SessionResponseUserSessionKey();
// All the other flags we send (signing, sealing, key
// exchange) are supported, but they don't do anything
// at all in an
// NTLM2 context! So we're done at this point.
- }
+ }
} else {
ntResp = gen.getNTLMResponse();
lmResp = gen.getLMResponse();
if ((type2Flags & FLAG_REQUEST_LAN_MANAGER_KEY) != 0) {
- userSessionKey = gen.getLanManagerSessionKey();
- } else {
- userSessionKey = gen.getNTLMUserSessionKey();
- }
+ userSessionKey = gen.getLanManagerSessionKey();
+ } else {
+ userSessionKey = gen.getNTLMUserSessionKey();
+ }
}
}
} catch (NTLMEngineException e) {
@@ -1215,17 +1215,17 @@ final class NTLMEngineImpl implements NT
ntResp = new byte[0];
lmResp = gen.getLMResponse();
if ((type2Flags & FLAG_REQUEST_LAN_MANAGER_KEY) != 0) {
- userSessionKey = gen.getLanManagerSessionKey();
- } else {
- userSessionKey = gen.getLMUserSessionKey();
- }
+ userSessionKey = gen.getLanManagerSessionKey();
+ } else {
+ userSessionKey = gen.getLMUserSessionKey();
+ }
}
if ((type2Flags & FLAG_REQUEST_EXPLICIT_KEY_EXCH) != 0) {
- sessionKey = RC4(gen.getSecondaryKey(), userSessionKey);
- } else {
- sessionKey = null;
- }
+ sessionKey = RC4(gen.getSecondaryKey(), userSessionKey);
+ } else {
+ sessionKey = null;
+ }
try {
domainBytes = domain.toUpperCase(Locale.US).getBytes("UnicodeLittleUnmarked");
@@ -1247,10 +1247,10 @@ final class NTLMEngineImpl implements NT
int userLen = userBytes.length;
int sessionKeyLen;
if (sessionKey != null) {
- sessionKeyLen = sessionKey.length;
- } else {
- sessionKeyLen = 0;
- }
+ sessionKeyLen = sessionKey.length;
+ } else {
+ sessionKeyLen = 0;
+ }
// Calculate the layout within the packet
int lmRespOffset = 72; // allocate space for the version
@@ -1349,8 +1349,8 @@ final class NTLMEngineImpl implements NT
addBytes(userBytes);
addBytes(hostBytes);
if (sessionKey != null) {
- addBytes(sessionKey);
- }
+ addBytes(sessionKey);
+ }
return super.getResponse();
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AIMDBackoffManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AIMDBackoffManager.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AIMDBackoffManager.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AIMDBackoffManager.java Tue Jan 15 20:08:10 2013
@@ -88,8 +88,8 @@ public class AIMDBackoffManager implemen
Long lastUpdate = getLastUpdate(lastRouteBackoffs, route);
long now = clock.getCurrentTime();
if (now - lastUpdate.longValue() < coolDown) {
- return;
- }
+ return;
+ }
connPerRoute.setMaxPerRoute(route, getBackedOffPoolSize(curr));
lastRouteBackoffs.put(route, Long.valueOf(now));
}
@@ -97,8 +97,8 @@ public class AIMDBackoffManager implemen
private int getBackedOffPoolSize(final int curr) {
if (curr <= 1) {
- return 1;
- }
+ return 1;
+ }
return (int)(Math.floor(backoffFactor * curr));
}
@@ -110,8 +110,8 @@ public class AIMDBackoffManager implemen
Long lastBackoff = getLastUpdate(lastRouteBackoffs, route);
long now = clock.getCurrentTime();
if (now - lastProbe.longValue() < coolDown || now - lastBackoff.longValue() < coolDown) {
- return;
- }
+ return;
+ }
connPerRoute.setMaxPerRoute(route, max);
lastRouteProbes.put(route, Long.valueOf(now));
}
@@ -120,8 +120,8 @@ public class AIMDBackoffManager implemen
private Long getLastUpdate(final Map<HttpRoute,Long> updates, final HttpRoute route) {
Long lastUpdate = updates.get(route);
if (lastUpdate == null) {
- lastUpdate = Long.valueOf(0L);
- }
+ lastUpdate = Long.valueOf(0L);
+ }
return lastUpdate;
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java Tue Jan 15 20:08:10 2013
@@ -841,11 +841,11 @@ public abstract class AbstractHttpClient
backoffManager.backOff(route);
}
if (e instanceof HttpException) {
- throw (HttpException)e;
- }
+ throw (HttpException)e;
+ }
if (e instanceof IOException) {
- throw (IOException)e;
- }
+ throw (IOException)e;
+ }
throw new UndeclaredThrowableException(e);
}
if (connectionBackoffStrategy.shouldBackoff(out)) {
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java Tue Jan 15 20:08:10 2013
@@ -148,8 +148,8 @@ public class DecompressingHttpClient imp
HttpContext context) throws IOException, ClientProtocolException {
try {
if (context == null) {
- context = new BasicHttpContext();
- }
+ context = new BasicHttpContext();
+ }
HttpRequest wrapped;
if (request instanceof HttpEntityEnclosingRequest) {
wrapped = new EntityEnclosingRequestWrapper((HttpEntityEnclosingRequest) request);
@@ -208,8 +208,8 @@ public class DecompressingHttpClient imp
} finally {
HttpEntity entity = response.getEntity();
if (entity != null) {
- EntityUtils.consume(entity);
- }
+ EntityUtils.consume(entity);
+ }
}
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java Tue Jan 15 20:08:10 2013
@@ -563,8 +563,8 @@ public class DefaultRequestDirector impl
!response.getEntity().isStreaming()) {
// connection not needed and (assumed to be) in re-usable state
if (reuse) {
- managedConn.markReusable();
- }
+ managedConn.markReusable();
+ }
releaseConnection();
} else {
// install an auto-release entity
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java Tue Jan 15 20:08:10 2013
@@ -159,20 +159,20 @@ public abstract class AbstractClientConn
public boolean isOpen() {
OperatedClientConnection conn = getWrappedConnection();
if (conn == null) {
- return false;
- }
+ return false;
+ }
return conn.isOpen();
}
public boolean isStale() {
if (isReleased()) {
- return true;
- }
+ return true;
+ }
OperatedClientConnection conn = getWrappedConnection();
if (conn == null) {
- return true;
- }
+ return true;
+ }
return conn.isStale();
}
@@ -277,8 +277,8 @@ public abstract class AbstractClientConn
OperatedClientConnection conn = getWrappedConnection();
assertValid(conn);
if (!isOpen()) {
- return null;
- }
+ return null;
+ }
return conn.getSocket();
}
@@ -286,8 +286,8 @@ public abstract class AbstractClientConn
OperatedClientConnection conn = getWrappedConnection();
assertValid(conn);
if (!isOpen()) {
- return null;
- }
+ return null;
+ }
SSLSession result = null;
Socket sock = conn.getSocket();
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java Tue Jan 15 20:08:10 2013
@@ -151,8 +151,8 @@ public abstract class AbstractPooledConn
public void close() throws IOException {
AbstractPoolEntry entry = getPoolEntry();
if (entry != null) {
- entry.shutdownEntry();
- }
+ entry.shutdownEntry();
+ }
OperatedClientConnection conn = getWrappedConnection();
if (conn != null) {
@@ -163,8 +163,8 @@ public abstract class AbstractPooledConn
public void shutdown() throws IOException {
AbstractPoolEntry entry = getPoolEntry();
if (entry != null) {
- entry.shutdownEntry();
- }
+ entry.shutdownEntry();
+ }
OperatedClientConnection conn = getWrappedConnection();
if (conn != null) {
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java Tue Jan 15 20:08:10 2013
@@ -157,8 +157,8 @@ public class DefaultClientConnection ext
}
Socket sock = this.socket; // copy volatile attribute
if (sock != null) {
- sock.close();
- }
+ sock.close();
+ }
} catch (IOException ex) {
log.debug("I/O error shutting down connection", ex);
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java Tue Jan 15 20:08:10 2013
@@ -89,8 +89,8 @@ public class DefaultHttpRoutePlanner imp
HttpRoute route =
ConnRouteParams.getForcedRoute(request.getParams());
if (route != null) {
- return route;
- }
+ return route;
+ }
// If we get here, there is no forced route.
// So we need a target to compute a route.
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java Tue Jan 15 20:08:10 2013
@@ -125,8 +125,8 @@ public class ProxySelectorRoutePlanner i
HttpRoute route =
ConnRouteParams.getForcedRoute(request.getParams());
if (route != null) {
- return route;
- }
+ return route;
+ }
// If we get here, there is no forced route.
// So we need a target to compute a route.
@@ -171,11 +171,11 @@ public class ProxySelectorRoutePlanner i
// the proxy selector can be 'unset', so we better deal with null here
ProxySelector psel = this.proxySelector;
if (psel == null) {
- psel = ProxySelector.getDefault();
- }
+ psel = ProxySelector.getDefault();
+ }
if (psel == null) {
- return null;
- }
+ return null;
+ }
URI targetURI = null;
try {
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java Tue Jan 15 20:08:10 2013
@@ -244,8 +244,8 @@ public class SingleClientConnManager imp
}
if (recreate) {
- uniquePoolEntry = new PoolEntry();
- }
+ uniquePoolEntry = new PoolEntry();
+ }
managedConn = new ConnAdapter(uniquePoolEntry, route);
@@ -267,9 +267,9 @@ public class SingleClientConnManager imp
ConnAdapter sca = (ConnAdapter) conn;
synchronized (sca) {
if (sca.poolEntry == null)
- {
- return; // already released
- }
+ {
+ return; // already released
+ }
ClientConnectionManager manager = sca.getManager();
Asserts.check(manager == this, "Connection not obtained from this manager");
try {
@@ -289,19 +289,19 @@ public class SingleClientConnManager imp
}
} catch (IOException iox) {
if (log.isDebugEnabled()) {
- log.debug("Exception shutting down released connection.",
+ log.debug("Exception shutting down released connection.",
iox);
- }
+ }
} finally {
sca.detach();
synchronized (this) {
managedConn = null;
lastReleaseTime = System.currentTimeMillis();
if(validDuration > 0) {
- connectionExpiresTime = timeUnit.toMillis(validDuration) + lastReleaseTime;
- } else {
- connectionExpiresTime = Long.MAX_VALUE;
- }
+ connectionExpiresTime = timeUnit.toMillis(validDuration) + lastReleaseTime;
+ } else {
+ connectionExpiresTime = Long.MAX_VALUE;
+ }
}
}
}
@@ -341,8 +341,8 @@ public class SingleClientConnManager imp
synchronized (this) {
try {
if (uniquePoolEntry != null) {
- uniquePoolEntry.shutdown();
- }
+ uniquePoolEntry.shutdown();
+ }
} catch (IOException iox) {
// ignore
log.debug("Problem while shutting down manager.", iox);
@@ -356,8 +356,8 @@ public class SingleClientConnManager imp
protected void revokeConnection() {
ConnAdapter conn = managedConn;
if (conn == null) {
- return;
- }
+ return;
+ }
conn.detach();
synchronized (this) {
@@ -389,8 +389,8 @@ public class SingleClientConnManager imp
protected void close() throws IOException {
shutdownEntry();
if (connection.isOpen()) {
- connection.close();
- }
+ connection.close();
+ }
}
/**
@@ -399,8 +399,8 @@ public class SingleClientConnManager imp
protected void shutdown() throws IOException {
shutdownEntry();
if (connection.isOpen()) {
- connection.shutdown();
- }
+ connection.shutdown();
+ }
}
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java Tue Jan 15 20:08:10 2013
@@ -195,8 +195,8 @@ public abstract class AbstractConnPool {
try {
if (isShutDown) {
- return;
- }
+ return;
+ }
// close all connections that are issued to an application
Iterator<BasicPoolEntry> iter = leasedConnections.iterator();
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java Tue Jan 15 20:08:10 2013
@@ -500,9 +500,9 @@ public class ConnPoolByRoute extends Abs
// If the free entry isn't valid anymore, get rid of it
// and loop to find another one that might be valid.
if (log.isDebugEnabled()) {
- log.debug("Closing expired free connection"
+ log.debug("Closing expired free connection"
+ " [" + rospl.getRoute() + "][" + state + "]");
- }
+ }
closeConnection(entry);
// We use dropEntry instead of deleteEntry because the entry
// is no longer "free" (we just allocated it), and deleteEntry
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java Tue Jan 15 20:08:10 2013
@@ -243,8 +243,8 @@ public class RouteSpecificPool {
final boolean found = freeEntries.remove(entry);
if (found) {
- numEntries--;
- }
+ numEntries--;
+ }
return found;
}
@@ -303,8 +303,8 @@ public class RouteSpecificPool {
*/
public void removeThread(final WaitingThread wt) {
if (wt == null) {
- return;
- }
+ return;
+ }
this.waitingThreads.remove(wt);
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java Tue Jan 15 20:08:10 2013
@@ -271,9 +271,9 @@ public class ThreadSafeClientConnManager
}
} catch (IOException iox) {
if (log.isDebugEnabled()) {
- log.debug("Exception shutting down released connection.",
+ log.debug("Exception shutting down released connection.",
iox);
- }
+ }
} finally {
boolean reusable = hca.isMarkedReusable();
if (log.isDebugEnabled()) {
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java Tue Jan 15 20:08:10 2013
@@ -146,8 +146,8 @@ public class WaitingThread {
}
if (aborted) {
- throw new InterruptedException("Operation interrupted");
- }
+ throw new InterruptedException("Operation interrupted");
+ }
this.waiter = Thread.currentThread();
@@ -160,8 +160,8 @@ public class WaitingThread {
success = true;
}
if (aborted) {
- throw new InterruptedException("Operation interrupted");
- }
+ throw new InterruptedException("Operation interrupted");
+ }
} finally {
this.waiter = null;
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java Tue Jan 15 20:08:10 2013
@@ -48,8 +48,8 @@ public class WaitingThreadAborter {
aborted = true;
if (waitingThread != null) {
- waitingThread.interrupt();
- }
+ waitingThread.interrupt();
+ }
}
@@ -62,8 +62,8 @@ public class WaitingThreadAborter {
public void setWaitingThread(final WaitingThread waitingThread) {
this.waitingThread = waitingThread;
if (aborted) {
- waitingThread.interrupt();
- }
+ waitingThread.interrupt();
+ }
}
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java Tue Jan 15 20:08:10 2013
@@ -157,8 +157,8 @@ public final class DateUtils {
ParsePosition pos = new ParsePosition(0);
Date result = dateParser.parse(dateValue, pos);
if (pos.getIndex() != 0) {
- return result;
- }
+ return result;
+ }
}
// we were unable to parse the date
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixFilter.java Tue Jan 15 20:08:10 2013
@@ -80,8 +80,8 @@ public class PublicSuffixFilter implemen
*/
public boolean match(final Cookie cookie, final CookieOrigin origin) {
if (isForPublicSuffix(cookie)) {
- return false;
- }
+ return false;
+ }
return wrapped.match(cookie, origin);
}
@@ -96,34 +96,34 @@ public class PublicSuffixFilter implemen
private boolean isForPublicSuffix(final Cookie cookie) {
String domain = cookie.getDomain();
if (domain.startsWith(".")) {
- domain = domain.substring(1);
- }
+ domain = domain.substring(1);
+ }
domain = Punycode.toUnicode(domain);
// An exception rule takes priority over any other matching rule.
if (this.exceptions != null) {
if (this.exceptions.contains(domain)) {
- return false;
- }
+ return false;
+ }
}
if (this.suffixes == null) {
- return false;
- }
+ return false;
+ }
do {
if (this.suffixes.contains(domain)) {
- return true;
- }
+ return true;
+ }
// patterns
if (domain.startsWith("*.")) {
- domain = domain.substring(2);
- }
+ domain = domain.substring(2);
+ }
int nextdot = domain.indexOf('.');
if (nextdot == -1) {
- break;
- }
+ break;
+ }
domain = "*" + domain.substring(nextdot);
} while (domain.length() > 0);
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixListParser.java Tue Jan 15 20:08:10 2013
@@ -67,21 +67,21 @@ public class PublicSuffixListParser {
more = readLine(r, sb);
String line = sb.toString();
if (line.length() == 0) {
- continue;
- }
+ continue;
+ }
if (line.startsWith("//"))
- {
- continue; //entire lines can also be commented using //
- }
+ {
+ continue; //entire lines can also be commented using //
+ }
if (line.startsWith("."))
- {
- line = line.substring(1); // A leading dot is optional
- }
+ {
+ line = line.substring(1); // A leading dot is optional
+ }
// An exclamation mark (!) at the start of a rule marks an exception to a previous wildcard rule
boolean isException = line.startsWith("!");
if (isException) {
- line = line.substring(1);
- }
+ line = line.substring(1);
+ }
if (isException) {
exceptions.add(line);
@@ -108,19 +108,19 @@ public class PublicSuffixListParser {
while ((b = r.read()) != -1) {
char c = (char) b;
if (c == '\n') {
- break;
- }
+ break;
+ }
// Each line is only read up to the first whitespace
if (Character.isWhitespace(c)) {
- hitWhitespace = true;
- }
+ hitWhitespace = true;
+ }
if (!hitWhitespace) {
- sb.append(c);
- }
+ sb.append(c);
+ }
if (sb.length() > MAX_LINE_LEN)
- {
- throw new IOException("Line too long"); // prevent excess memory usage
- }
+ {
+ throw new IOException("Line too long"); // prevent excess memory usage
+ }
}
return (b != -1);
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java Tue Jan 15 20:08:10 2013
@@ -83,14 +83,14 @@ public class BackoffStrategyExec impleme
this.backoffManager.backOff(route);
}
if (ex instanceof RuntimeException) {
- throw (RuntimeException) ex;
- }
+ throw (RuntimeException) ex;
+ }
if (ex instanceof HttpException) {
- throw (HttpException) ex;
- }
+ throw (HttpException) ex;
+ }
if (ex instanceof IOException) {
- throw (IOException) ex;
- }
+ throw (IOException) ex;
+ }
throw new UndeclaredThrowableException(ex);
}
if (this.connectionBackoffStrategy.shouldBackoff(out)) {
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java Tue Jan 15 20:08:10 2013
@@ -138,12 +138,12 @@ public class TestScheme {
String name = names.get(0);
if ("http".equals(name)) {
- flaghttp = true;
- } else if ("https".equals(name)) {
- flaghttps = true;
- } else {
- Assert.fail("unexpected name in iterator: " + name);
- }
+ flaghttp = true;
+ } else if ("https".equals(name)) {
+ flaghttps = true;
+ } else {
+ Assert.fail("unexpected name in iterator: " + name);
+ }
Assert.assertNotNull(schmreg.get(name));
schmreg.unregister(name);
@@ -153,12 +153,12 @@ public class TestScheme {
if ("http".equals(name)) {
if (flaghttp) {
- Assert.fail("name 'http' found twice");
- }
+ Assert.fail("name 'http' found twice");
+ }
} else if ("https".equals(name)) {
if (flaghttps) {
- Assert.fail("name 'https' found twice");
- }
+ Assert.fail("name 'https' found twice");
+ }
} else {
Assert.fail("unexpected name in iterator: " + name);
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java Tue Jan 15 20:08:10 2013
@@ -692,8 +692,8 @@ public class TestRouteTracker {
*/
public final static String checkToString(final RouteTracker rt) {
if (rt == null) {
- return null;
- }
+ return null;
+ }
final String rts = rt.toString();
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestNTLMEngineImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestNTLMEngineImpl.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestNTLMEngineImpl.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestNTLMEngineImpl.java Tue Jan 15 20:08:10 2013
@@ -48,8 +48,8 @@ public class TestNTLMEngineImpl {
/* Test suite helper */
static byte toNibble(final char c) {
if (c >= 'a' && c <= 'f') {
- return (byte) (c - 'a' + 0x0a);
- }
+ return (byte) (c - 'a' + 0x0a);
+ }
return (byte) (c - '0');
}
@@ -73,14 +73,14 @@ public class TestNTLMEngineImpl {
byte[] answer = md4.getOutput();
byte[] correctAnswer = toBytes(hexOutput);
if (answer.length != correctAnswer.length) {
- throw new Exception("Answer length disagrees for MD4('" + input + "')");
- }
+ throw new Exception("Answer length disagrees for MD4('" + input + "')");
+ }
int i = 0;
while (i < answer.length) {
if (answer[i] != correctAnswer[i]) {
- throw new Exception("Answer value for MD4('" + input + "') disagrees at position "
+ throw new Exception("Answer value for MD4('" + input + "') disagrees at position "
+ Integer.toString(i));
- }
+ }
i++;
}
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAIMDBackoffManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAIMDBackoffManager.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAIMDBackoffManager.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAIMDBackoffManager.java Tue Jan 15 20:08:10 2013
@@ -160,11 +160,11 @@ public class TestAIMDBackoffManager {
public void coolDownPeriodIsConfigurable() {
long cd = new Random().nextLong() / 2;
if (cd < 0) {
- cd *= -1;
- }
+ cd *= -1;
+ }
if (cd < 1) {
- cd++;
- }
+ cd++;
+ }
long now = System.currentTimeMillis();
impl.setCooldownMillis(cd);
clock.setCurrentTime(now);
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDecompressingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDecompressingHttpClient.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDecompressingHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDecompressingHttpClient.java Tue Jan 15 20:08:10 2013
@@ -156,11 +156,11 @@ public class TestDecompressingHttpClient
for(Header h : captured.getHeaders("Accept-Encoding")) {
for(HeaderElement elt : h.getElements()) {
if ("gzip".equals(elt.getName())) {
- foundGzip = true;
- }
+ foundGzip = true;
+ }
if ("deflate".equals(elt.getName())) {
- foundDeflate = true;
- }
+ foundDeflate = true;
+ }
}
}
assertTrue(foundGzip);
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultBackoffStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultBackoffStrategy.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultBackoffStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultBackoffStrategy.java Tue Jan 15 20:08:10 2013
@@ -82,8 +82,8 @@ public class TestDefaultBackoffStrategy
public void doesNotBackOffForNon503StatusCodes() {
for(int i = 100; i <= 599; i++) {
if (i == HttpStatus.SC_SERVICE_UNAVAILABLE) {
- continue;
- }
+ continue;
+ }
HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1,
i, "Foo");
assertFalse(impl.shouldBackoff(resp));
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java Tue Jan 15 20:08:10 2013
@@ -216,8 +216,8 @@ public class TestAbortHandling extends I
try {
try {
if(!startLatch.await(1, TimeUnit.SECONDS)) {
- throw new RuntimeException("Took too long to start!");
- }
+ throw new RuntimeException("Took too long to start!");
+ }
} catch(InterruptedException interrupted) {
throw new RuntimeException("Never started!", interrupted);
}
@@ -376,12 +376,12 @@ public class TestAbortHandling extends I
// zero usually means sleep forever, but CountDownLatch doesn't interpret it that way.
if(timeout == 0) {
- timeout = Integer.MAX_VALUE;
- }
+ timeout = Integer.MAX_VALUE;
+ }
if(!awaitLatch.await(timeout, tunit)) {
- throw new ConnectionPoolTimeoutException();
- }
+ throw new ConnectionPoolTimeoutException();
+ }
return Mockito.mock(HttpClientConnection.class);
}
@@ -436,12 +436,12 @@ public class TestAbortHandling extends I
// zero usually means sleep forever, but CountDownLatch doesn't interpret it that way.
if(timeout == 0) {
- timeout = Integer.MAX_VALUE;
- }
+ timeout = Integer.MAX_VALUE;
+ }
if(!awaitLatch.await(timeout, tunit)) {
- throw new ConnectionPoolTimeoutException();
- }
+ throw new ConnectionPoolTimeoutException();
+ }
return Mockito.mock(HttpClientConnection.class);
}
@@ -491,8 +491,8 @@ public class TestAbortHandling extends I
public void setCancellable(final Cancellable cancellable) {
try {
if(!releaseTriggerLatch.await(1, TimeUnit.SECONDS)) {
- throw new RuntimeException("Waited too long...");
- }
+ throw new RuntimeException("Waited too long...");
+ }
} catch(InterruptedException ie) {
throw new RuntimeException(ie);
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java Tue Jan 15 20:08:10 2013
@@ -463,8 +463,8 @@ public class TestConnectionManagement ex
abortingThread.join(5000);
if(throwRef.get() != null) {
- throw new RuntimeException(throwRef.get());
- }
+ throw new RuntimeException(throwRef.get());
+ }
Assert.assertFalse(conn.isOpen());
Assert.assertEquals(0, localServer.getAcceptedConnectionCount());
@@ -518,8 +518,8 @@ public class TestConnectionManagement ex
abortingThread.join(5000);
if(throwRef.get() != null) {
- throw new RuntimeException(throwRef.get());
- }
+ throw new RuntimeException(throwRef.get());
+ }
Assert.assertFalse(conn.isOpen());
Assert.assertEquals(0, localServer.getAcceptedConnectionCount());
@@ -573,16 +573,16 @@ public class TestConnectionManagement ex
abortingThread.join(5000);
if(throwRef.get() != null) {
- throw new RuntimeException(throwRef.get());
- }
+ throw new RuntimeException(throwRef.get());
+ }
Assert.assertFalse(conn.isOpen());
// Give the server a bit of time to accept the connection, but
// ensure that it can accept it.
for(int i = 0; i < 10; i++) {
if(localServer.getAcceptedConnectionCount() == 1) {
- break;
- }
+ break;
+ }
Thread.sleep(100);
}
Assert.assertEquals(1, localServer.getAcceptedConnectionCount());
@@ -608,16 +608,16 @@ public class TestConnectionManagement ex
void waitForState() throws InterruptedException {
if(!waitLatch.await(1, TimeUnit.SECONDS)) {
- throw new RuntimeException("waited too long");
- }
+ throw new RuntimeException("waited too long");
+ }
}
void latch() {
waitLatch.countDown();
try {
if (!continueLatch.await(60, TimeUnit.SECONDS)) {
- throw new RuntimeException("waited too long!");
- }
+ throw new RuntimeException("waited too long!");
+ }
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@@ -644,23 +644,23 @@ public class TestConnectionManagement ex
final InetSocketAddress localAddress,
final HttpContext context) throws IOException, ConnectTimeoutException {
if(waitPolicy == WaitPolicy.BEFORE_CONNECT) {
- latch();
- }
+ latch();
+ }
Socket socket = delegate.connectSocket(
connectTimeout, sock, host, remoteAddress, localAddress, context);
if(waitPolicy == WaitPolicy.AFTER_CONNECT) {
- latch();
- }
+ latch();
+ }
return socket;
}
public Socket createSocket(final HttpContext context) throws IOException {
if(waitPolicy == WaitPolicy.BEFORE_CREATE) {
- latch();
- }
+ latch();
+ }
return delegate.createSocket(context);
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/EchoHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/EchoHandler.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/EchoHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/EchoHandler.java Tue Jan 15 20:08:10 2013
@@ -83,8 +83,8 @@ public class EchoHandler
HttpEntity entity = null;
if (request instanceof HttpEntityEnclosingRequest) {
- entity = ((HttpEntityEnclosingRequest)request).getEntity();
- }
+ entity = ((HttpEntityEnclosingRequest)request).getEntity();
+ }
// For some reason, just putting the incoming entity into
// the response will not work. We have to buffer the message.
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java?rev=1433610&r1=1433609&r2=1433610&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java Tue Jan 15 20:08:10 2013
@@ -273,10 +273,10 @@ public class LocalTestServer {
StringBuilder sb = new StringBuilder(80);
sb.append("LocalTestServer/");
if (ssock == null) {
- sb.append("stopped");
- } else {
- sb.append(ssock.getLocalSocketAddress());
- }
+ sb.append("stopped");
+ } else {
+ sb.append(ssock.getLocalSocketAddress());
+ }
return sb.toString();
}