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/12/28 17:09:02 UTC
svn commit: r1553861 [1/2] - in
/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http:
client/protocol/ conn/ssl/ impl/auth/ impl/client/ impl/conn/ impl/execchain/
Author: olegk
Date: Sat Dec 28 16:09:01 2013
New Revision: 1553861
URL: http://svn.apache.org/r1553861
Log:
Android specific modifications of HttpClient 4.3.1
Modified:
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/conn/ssl/AbstractVerifierHC4.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPool.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPoolEntry.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParser.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/InMemoryDnsResolver.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/WireHC4.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RetryExec.java
httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java Sat Dec 28 16:09:01 2013
@@ -34,8 +34,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
@@ -67,7 +67,7 @@ import org.apache.http.util.TextUtils;
@Immutable
public class RequestAddCookiesHC4 implements HttpRequestInterceptor {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
public RequestAddCookiesHC4() {
super();
@@ -88,28 +88,28 @@ public class RequestAddCookiesHC4 implem
// Obtain cookie store
final CookieStore cookieStore = clientContext.getCookieStore();
if (cookieStore == null) {
- this.log.debug("Cookie store not specified in HTTP context");
+ Log.d(tag, "Cookie store not specified in HTTP context");
return;
}
// Obtain the registry of cookie specs
final Lookup<CookieSpecProvider> registry = clientContext.getCookieSpecRegistry();
if (registry == null) {
- this.log.debug("CookieSpec registry not specified in HTTP context");
+ Log.d(tag, "CookieSpec registry not specified in HTTP context");
return;
}
// Obtain the target host, possibly virtual (required)
final HttpHost targetHost = clientContext.getTargetHost();
if (targetHost == null) {
- this.log.debug("Target host not set in the context");
+ Log.d(tag, "Target host not set in the context");
return;
}
// Obtain the route (required)
final RouteInfo route = clientContext.getHttpRoute();
if (route == null) {
- this.log.debug("Connection route not set in the context");
+ Log.d(tag, "Connection route not set in the context");
return;
}
@@ -118,8 +118,8 @@ public class RequestAddCookiesHC4 implem
if (policy == null) {
policy = CookieSpecs.BEST_MATCH;
}
- if (this.log.isDebugEnabled()) {
- this.log.debug("CookieSpec selected: " + policy);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "CookieSpec selected: " + policy);
}
URI requestURI = null;
@@ -158,14 +158,14 @@ public class RequestAddCookiesHC4 implem
for (final Cookie cookie : cookies) {
if (!cookie.isExpired(now)) {
if (cookieSpec.match(cookie, cookieOrigin)) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Cookie " + cookie + " match " + cookieOrigin);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Cookie " + cookie + " match " + cookieOrigin);
}
matchedCookies.add(cookie);
}
} else {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Cookie " + cookie + " expired");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Cookie " + cookie + " expired");
}
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java Sat Dec 28 16:09:01 2013
@@ -29,8 +29,8 @@ package org.apache.http.client.protocol;
import java.io.IOException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@@ -57,7 +57,7 @@ import org.apache.http.util.Args;
@Immutable
public class RequestAuthCache implements HttpRequestInterceptor {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
public RequestAuthCache() {
super();
@@ -72,13 +72,13 @@ public class RequestAuthCache implements
final AuthCache authCache = clientContext.getAuthCache();
if (authCache == null) {
- this.log.debug("Auth cache not set in the context");
+ Log.d(tag, "Auth cache not set in the context");
return;
}
final CredentialsProvider credsProvider = clientContext.getCredentialsProvider();
if (credsProvider == null) {
- this.log.debug("Credentials provider not set in the context");
+ Log.d(tag, "Credentials provider not set in the context");
return;
}
@@ -115,8 +115,8 @@ public class RequestAuthCache implements
final AuthStateHC4 authState,
final CredentialsProvider credsProvider) {
final String schemeName = authScheme.getSchemeName();
- if (this.log.isDebugEnabled()) {
- this.log.debug("Re-using cached '" + schemeName + "' auth scheme for " + host);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Re-using cached '" + schemeName + "' auth scheme for " + host);
}
final AuthScope authScope = new AuthScope(host.getHostName(), host.getPort(), AuthScope.ANY_REALM, schemeName);
@@ -130,7 +130,7 @@ public class RequestAuthCache implements
}
authState.update(authScheme, creds);
} else {
- this.log.debug("No credentials for preemptive authentication");
+ Log.d(tag, "No credentials for preemptive authentication");
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java Sat Dec 28 16:09:01 2013
@@ -29,8 +29,8 @@ package org.apache.http.client.protocol;
import java.io.IOException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
@@ -50,7 +50,7 @@ import org.apache.http.util.Args;
@Immutable
public class RequestClientConnControl implements HttpRequestInterceptor {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private static final String PROXY_CONN_DIRECTIVE = "Proxy-Connection";
@@ -73,7 +73,7 @@ public class RequestClientConnControl im
// Obtain the client connection (required)
final RouteInfo route = clientContext.getHttpRoute();
if (route == null) {
- this.log.debug("Connection route not set in the context");
+ Log.d(tag, "Connection route not set in the context");
return;
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java Sat Dec 28 16:09:01 2013
@@ -30,8 +30,8 @@ package org.apache.http.client.protocol;
import java.io.IOException;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.Header;
import org.apache.http.HeaderIterator;
import org.apache.http.HttpException;
@@ -56,7 +56,7 @@ import org.apache.http.util.Args;
@Immutable
public class ResponseProcessCookiesHC4 implements HttpResponseInterceptor {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
public ResponseProcessCookiesHC4() {
super();
@@ -72,19 +72,19 @@ public class ResponseProcessCookiesHC4 i
// Obtain actual CookieSpec instance
final CookieSpec cookieSpec = clientContext.getCookieSpec();
if (cookieSpec == null) {
- this.log.debug("Cookie spec not specified in HTTP context");
+ Log.d(tag, "Cookie spec not specified in HTTP context");
return;
}
// Obtain cookie store
final CookieStore cookieStore = clientContext.getCookieStore();
if (cookieStore == null) {
- this.log.debug("Cookie store not specified in HTTP context");
+ Log.d(tag, "Cookie store not specified in HTTP context");
return;
}
// Obtain actual CookieOrigin instance
final CookieOrigin cookieOrigin = clientContext.getCookieOrigin();
if (cookieOrigin == null) {
- this.log.debug("Cookie origin not specified in HTTP context");
+ Log.d(tag, "Cookie origin not specified in HTTP context");
return;
}
HeaderIterator it = response.headerIterator(SM.SET_COOKIE);
@@ -113,20 +113,20 @@ public class ResponseProcessCookiesHC4 i
cookieSpec.validate(cookie, cookieOrigin);
cookieStore.addCookie(cookie);
- if (this.log.isDebugEnabled()) {
- this.log.debug("Cookie accepted: \""
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Cookie accepted: \""
+ cookie + "\". ");
}
} catch (final MalformedCookieException ex) {
- if (this.log.isWarnEnabled()) {
- this.log.warn("Cookie rejected: \""
+ if (Log.isLoggable(tag, Log.WARN)) {
+ Log.w(tag, "Cookie rejected: \""
+ cookie + "\". " + ex.getMessage());
}
}
}
} catch (final MalformedCookieException ex) {
- if (this.log.isWarnEnabled()) {
- this.log.warn("Invalid cookie header: \""
+ if (Log.isLoggable(tag, Log.WARN)) {
+ Log.w(tag, "Invalid cookie header: \""
+ header + "\". " + ex.getMessage());
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/conn/ssl/AbstractVerifierHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/conn/ssl/AbstractVerifierHC4.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/conn/ssl/AbstractVerifierHC4.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/conn/ssl/AbstractVerifierHC4.java Sat Dec 28 16:09:01 2013
@@ -46,8 +46,8 @@ import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.annotation.Immutable;
import org.apache.http.conn.util.InetAddressUtilsHC4;
@@ -79,7 +79,7 @@ public abstract class AbstractVerifierHC
Arrays.sort(BAD_COUNTRY_2LDS);
}
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
public AbstractVerifierHC4() {
super();
@@ -389,7 +389,7 @@ public abstract class AbstractVerifierHC
final InetAddress inetAddress = InetAddress.getByName(hostname);
return inetAddress.getHostAddress();
} catch (UnknownHostException uhe) { // Should not happen, because we check for IPv6 address above
- log.error("Unexpected error converting "+hostname, uhe);
+ Log.e(tag, "Unexpected error converting "+hostname, uhe);
return hostname;
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java Sat Dec 28 16:09:01 2013
@@ -27,8 +27,8 @@
package org.apache.http.impl.auth;
import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@@ -63,7 +63,7 @@ public abstract class GGSSchemeBase exte
FAILED,
}
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final Base64 base64codec;
private final boolean stripPort;
@@ -155,8 +155,8 @@ public abstract class GGSSchemeBase exte
authServer = host.getHostName();
}
- if (log.isDebugEnabled()) {
- log.debug("init " + authServer);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "init " + authServer);
}
token = generateToken(token, authServer);
state = State.TOKEN_GENERATED;
@@ -179,8 +179,8 @@ public abstract class GGSSchemeBase exte
}
case TOKEN_GENERATED:
final String tokenstr = new String(base64codec.encode(token));
- if (log.isDebugEnabled()) {
- log.debug("Sending response '" + tokenstr + "' back to the auth server");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Sending response '" + tokenstr + "' back to the auth server");
}
final CharArrayBuffer buffer = new CharArrayBuffer(32);
if (isProxy()) {
@@ -201,14 +201,14 @@ public abstract class GGSSchemeBase exte
final CharArrayBuffer buffer,
final int beginIndex, final int endIndex) throws MalformedChallengeException {
final String challenge = buffer.substringTrimmed(beginIndex, endIndex);
- if (log.isDebugEnabled()) {
- log.debug("Received challenge '" + challenge + "' from the auth server");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Received challenge '" + challenge + "' from the auth server");
}
if (state == State.UNINITIATED) {
token = Base64.decodeBase64(challenge.getBytes());
state = State.CHALLENGE_RECEIVED;
} else {
- log.debug("Authentication already attempted");
+ Log.d(tag, "Authentication already attempted");
state = State.FAILED;
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java Sat Dec 28 16:09:01 2013
@@ -32,8 +32,8 @@ import java.util.Locale;
import java.util.Map;
import java.util.Queue;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
@@ -56,15 +56,10 @@ import org.apache.http.util.Asserts;
*/
public class HttpAuthenticator {
- private final Log log;
-
- public HttpAuthenticator(final Log log) {
- super();
- this.log = log != null ? log : LogFactory.getLog(getClass());
- }
+ private final String tag = getClass().getName();
public HttpAuthenticator() {
- this(null);
+ super();
}
public boolean isAuthenticationRequested(
@@ -74,7 +69,7 @@ public class HttpAuthenticator {
final AuthStateHC4 authState,
final HttpContext context) {
if (authStrategy.isAuthenticationRequested(host, response, context)) {
- this.log.debug("Authentication required");
+ Log.d(tag, "Authentication required");
if (authState.getState() == AuthProtocolState.SUCCESS) {
authStrategy.authFailed(host, authState.getAuthScheme(), context);
}
@@ -83,7 +78,7 @@ public class HttpAuthenticator {
switch (authState.getState()) {
case CHALLENGED:
case HANDSHAKE:
- this.log.debug("Authentication succeeded");
+ Log.d(tag, "Authentication succeeded");
authState.setState(AuthProtocolState.SUCCESS);
authStrategy.authSucceeded(host, authState.getAuthScheme(), context);
break;
@@ -103,12 +98,12 @@ public class HttpAuthenticator {
final AuthStateHC4 authState,
final HttpContext context) {
try {
- if (this.log.isDebugEnabled()) {
- this.log.debug(host.toHostString() + " requested authentication");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, host.toHostString() + " requested authentication");
}
final Map<String, Header> challenges = authStrategy.getChallenges(host, response, context);
if (challenges.isEmpty()) {
- this.log.debug("Response contains no authentication challenges");
+ Log.d(tag, "Response contains no authentication challenges");
return false;
}
@@ -122,7 +117,7 @@ public class HttpAuthenticator {
case CHALLENGED:
case HANDSHAKE:
if (authScheme == null) {
- this.log.debug("Auth scheme is null");
+ Log.d(tag, "Auth scheme is null");
authStrategy.authFailed(host, null, context);
authState.reset();
authState.setState(AuthProtocolState.FAILURE);
@@ -133,10 +128,10 @@ public class HttpAuthenticator {
final String id = authScheme.getSchemeName();
final Header challenge = challenges.get(id.toLowerCase(Locale.US));
if (challenge != null) {
- this.log.debug("Authorization challenge processed");
+ Log.d(tag, "Authorization challenge processed");
authScheme.processChallenge(challenge);
if (authScheme.isComplete()) {
- this.log.debug("Authentication failed");
+ Log.d(tag, "Authentication failed");
authStrategy.authFailed(host, authState.getAuthScheme(), context);
authState.reset();
authState.setState(AuthProtocolState.FAILURE);
@@ -153,8 +148,8 @@ public class HttpAuthenticator {
}
final Queue<AuthOption> authOptions = authStrategy.select(challenges, host, response, context);
if (authOptions != null && !authOptions.isEmpty()) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Selected authentication options: " + authOptions);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Selected authentication options: " + authOptions);
}
authState.setState(AuthProtocolState.CHALLENGED);
authState.update(authOptions);
@@ -163,8 +158,8 @@ public class HttpAuthenticator {
return false;
}
} catch (final MalformedChallengeException ex) {
- if (this.log.isWarnEnabled()) {
- this.log.warn("Malformed challenge: " + ex.getMessage());
+ if (Log.isLoggable(tag, Log.WARN)) {
+ Log.w(tag, "Malformed challenge: " + ex.getMessage());
}
authState.reset();
return false;
@@ -194,8 +189,8 @@ public class HttpAuthenticator {
authScheme = authOption.getAuthScheme();
creds = authOption.getCredentials();
authState.update(authScheme, creds);
- if (this.log.isDebugEnabled()) {
- this.log.debug("Generating response to an authentication challenge using "
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Generating response to an authentication challenge using "
+ authScheme.getSchemeName() + " scheme");
}
try {
@@ -203,8 +198,8 @@ public class HttpAuthenticator {
request.addHeader(header);
break;
} catch (final AuthenticationException ex) {
- if (this.log.isWarnEnabled()) {
- this.log.warn(authScheme + " authentication error: " + ex.getMessage());
+ if (Log.isLoggable(tag, Log.WARN)) {
+ Log.w(tag, authScheme + " authentication error: " + ex.getMessage());
}
}
}
@@ -218,8 +213,8 @@ public class HttpAuthenticator {
final Header header = doAuth(authScheme, creds, request, context);
request.addHeader(header);
} catch (final AuthenticationException ex) {
- if (this.log.isErrorEnabled()) {
- this.log.error(authScheme + " authentication error: " + ex.getMessage());
+ if (Log.isLoggable(tag, Log.ERROR)) {
+ Log.e(tag, authScheme + " authentication error: " + ex.getMessage());
}
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java Sat Dec 28 16:09:01 2013
@@ -37,8 +37,8 @@ import java.util.Locale;
import java.util.Map;
import java.util.Queue;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.FormattedHeader;
import org.apache.http.Header;
import org.apache.http.HttpHost;
@@ -65,7 +65,7 @@ import org.apache.http.util.CharArrayBuf
@Immutable
abstract class AuthenticationStrategyImpl implements AuthenticationStrategy {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private static final List<String> DEFAULT_SCHEME_PRIORITY =
Collections.unmodifiableList(Arrays.asList(AuthSchemes.SPNEGO,
@@ -144,12 +144,12 @@ abstract class AuthenticationStrategyImp
final Queue<AuthOption> options = new LinkedList<AuthOption>();
final Lookup<AuthSchemeProvider> registry = clientContext.getAuthSchemeRegistry();
if (registry == null) {
- this.log.debug("Auth scheme registry not set in the context");
+ Log.d(tag, "Auth scheme registry not set in the context");
return options;
}
final CredentialsProvider credsProvider = clientContext.getCredentialsProvider();
if (credsProvider == null) {
- this.log.debug("Credentials provider not set in the context");
+ Log.d(tag, "Credentials provider not set in the context");
return options;
}
final RequestConfig config = clientContext.getRequestConfig();
@@ -157,8 +157,8 @@ abstract class AuthenticationStrategyImp
if (authPrefs == null) {
authPrefs = DEFAULT_SCHEME_PRIORITY;
}
- if (this.log.isDebugEnabled()) {
- this.log.debug("Authentication schemes in the order of preference: " + authPrefs);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Authentication schemes in the order of preference: " + authPrefs);
}
for (final String id: authPrefs) {
@@ -166,8 +166,8 @@ abstract class AuthenticationStrategyImp
if (challenge != null) {
final AuthSchemeProvider authSchemeProvider = registry.lookup(id);
if (authSchemeProvider == null) {
- if (this.log.isWarnEnabled()) {
- this.log.warn("Authentication scheme " + id + " not supported");
+ if (Log.isLoggable(tag, Log.WARN)) {
+ Log.w(tag, "Authentication scheme " + id + " not supported");
// Try again
}
continue;
@@ -186,8 +186,8 @@ abstract class AuthenticationStrategyImp
options.add(new AuthOption(authScheme, credentials));
}
} else {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Challenge for " + id + " authentication scheme not available");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Challenge for " + id + " authentication scheme not available");
// Try again
}
}
@@ -209,8 +209,8 @@ abstract class AuthenticationStrategyImp
authCache = new BasicAuthCache();
clientContext.setAuthCache(authCache);
}
- if (this.log.isDebugEnabled()) {
- this.log.debug("Caching '" + authScheme.getSchemeName() +
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Caching '" + authScheme.getSchemeName() +
"' auth scheme for " + authhost);
}
authCache.put(authhost, authScheme);
@@ -235,8 +235,8 @@ abstract class AuthenticationStrategyImp
final AuthCache authCache = clientContext.getAuthCache();
if (authCache != null) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Clearing cached auth scheme for " + authhost);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Clearing cached auth scheme for " + authhost);
}
authCache.remove(authhost);
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java Sat Dec 28 16:09:01 2013
@@ -32,8 +32,8 @@ import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.URI;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@@ -57,7 +57,7 @@ import org.apache.http.util.EntityUtilsH
@ThreadSafe
public abstract class CloseableHttpClient implements HttpClient, Closeable {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
protected abstract CloseableHttpResponse doExecute(HttpHost target, HttpRequest request,
HttpContext context) throws IOException, ClientProtocolException;
@@ -223,7 +223,7 @@ public abstract class CloseableHttpClien
} catch (final Exception t2) {
// Log this exception. The original exception is more
// important and will be thrown to the caller.
- this.log.warn("Error consuming content after an exception.", t2);
+ Log.w(tag, "Error consuming content after an exception.", t2);
}
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java Sat Dec 28 16:09:01 2013
@@ -31,8 +31,8 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@@ -72,7 +72,7 @@ import org.apache.http.util.TextUtils;
@Immutable
public class DefaultRedirectStrategy implements RedirectStrategy {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
/**
* @deprecated (4.3) use {@link org.apache.http.client.protocol.HttpClientContext#REDIRECT_LOCATIONS}.
@@ -136,8 +136,8 @@ public class DefaultRedirectStrategy imp
+ " but no location header");
}
final String location = locationHeader.getValue();
- if (this.log.isDebugEnabled()) {
- this.log.debug("Redirect requested to location '" + location + "'");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Redirect requested to location '" + location + "'");
}
final RequestConfig config = clientContext.getRequestConfig();
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/InternalHttpClient.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/InternalHttpClient.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/client/InternalHttpClient.java Sat Dec 28 16:09:01 2013
@@ -32,8 +32,8 @@ import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@@ -77,7 +77,7 @@ import org.apache.http.util.Asserts;
@SuppressWarnings("deprecation")
class InternalHttpClient extends CloseableHttpClient {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final ClientExecChain execChain;
private final HttpClientConnectionManager connManager;
@@ -196,7 +196,7 @@ class InternalHttpClient extends Closeab
try {
closeable.close();
} catch (final IOException ex) {
- this.log.error(ex.getMessage(), ex);
+ Log.e(tag, ex.getMessage(), ex);
}
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java Sat Dec 28 16:09:01 2013
@@ -33,8 +33,8 @@ import java.net.InetSocketAddress;
import java.util.Date;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpClientConnection;
import org.apache.http.HttpHost;
import org.apache.http.annotation.GuardedBy;
@@ -78,7 +78,7 @@ import org.apache.http.util.LangUtils;
@ThreadSafe
public class BasicHttpClientConnectionManager implements HttpClientConnectionManager, Closeable {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final HttpClientConnectionOperator connectionOperator;
private final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory;
@@ -204,12 +204,12 @@ public class BasicHttpClientConnectionMa
private void closeConnection() {
if (this.conn != null) {
- this.log.debug("Closing connection");
+ Log.d(tag, "Closing connection");
try {
this.conn.close();
} catch (final IOException iox) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("I/O exception closing connection", iox);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "I/O exception closing connection", iox);
}
}
this.conn = null;
@@ -218,12 +218,12 @@ public class BasicHttpClientConnectionMa
private void shutdownConnection() {
if (this.conn != null) {
- this.log.debug("Shutting down connection");
+ Log.d(tag, "Shutting down connection");
try {
this.conn.shutdown();
} catch (final IOException iox) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("I/O exception shutting down connection", iox);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "I/O exception shutting down connection", iox);
}
}
this.conn = null;
@@ -232,8 +232,8 @@ public class BasicHttpClientConnectionMa
private void checkExpiry() {
if (this.conn != null && System.currentTimeMillis() >= this.expiry) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Connection expired @ " + new Date(this.expiry));
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Connection expired @ " + new Date(this.expiry));
}
closeConnection();
}
@@ -241,8 +241,8 @@ public class BasicHttpClientConnectionMa
synchronized HttpClientConnection getConnection(final HttpRoute route, final Object state) {
Asserts.check(!this.shutdown, "Connection manager has been shut down");
- if (this.log.isDebugEnabled()) {
- this.log.debug("Get connection for route " + route);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Get connection for route " + route);
}
Asserts.check(!this.leased, "Connection is still allocated");
if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) {
@@ -264,8 +264,8 @@ public class BasicHttpClientConnectionMa
final long keepalive, final TimeUnit tunit) {
Args.notNull(conn, "Connection");
Asserts.check(conn == this.conn, "Connection not obtained from this manager");
- if (this.log.isDebugEnabled()) {
- this.log.debug("Releasing connection " + conn);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Releasing connection " + conn);
}
if (this.shutdown) {
shutdownConnection();
@@ -280,14 +280,14 @@ public class BasicHttpClientConnectionMa
this.expiry = Long.MAX_VALUE;
} else {
this.state = state;
- if (this.log.isDebugEnabled()) {
+ if (Log.isLoggable(tag, Log.DEBUG)) {
final String s;
if (keepalive > 0) {
s = "for " + keepalive + " " + tunit;
} else {
s = "indefinitely";
}
- this.log.debug("Connection can be kept alive " + s);
+ Log.d(tag, "Connection can be kept alive " + s);
}
if (keepalive > 0) {
this.expiry = this.updated + tunit.toMillis(keepalive);
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPool.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPool.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPool.java Sat Dec 28 16:09:01 2013
@@ -29,8 +29,8 @@ package org.apache.http.impl.conn;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.conn.ManagedHttpClientConnection;
import org.apache.http.conn.routing.HttpRoute;
@@ -45,7 +45,6 @@ class CPool extends AbstractConnPool<Htt
private static final AtomicLong COUNTER = new AtomicLong();
- private final Log log = LogFactory.getLog(CPool.class);
private final long timeToLive;
private final TimeUnit tunit;
@@ -61,7 +60,7 @@ class CPool extends AbstractConnPool<Htt
@Override
protected CPoolEntry createEntry(final HttpRoute route, final ManagedHttpClientConnection conn) {
final String id = Long.toString(COUNTER.getAndIncrement());
- return new CPoolEntry(this.log, id, route, conn, this.timeToLive, this.tunit);
+ return new CPoolEntry(id, route, conn, this.timeToLive, this.tunit);
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPoolEntry.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPoolEntry.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/CPoolEntry.java Sat Dec 28 16:09:01 2013
@@ -30,7 +30,7 @@ import java.io.IOException;
import java.util.Date;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.logging.Log;
+import android.util.Log;
import org.apache.http.HttpClientConnection;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.conn.ManagedHttpClientConnection;
@@ -43,17 +43,15 @@ import org.apache.http.pool.PoolEntry;
@ThreadSafe
class CPoolEntry extends PoolEntry<HttpRoute, ManagedHttpClientConnection> {
- private final Log log;
+ private final String tag = getClass().getName();
private volatile boolean routeComplete;
public CPoolEntry(
- final Log log,
final String id,
final HttpRoute route,
final ManagedHttpClientConnection conn,
final long timeToLive, final TimeUnit tunit) {
super(id, route, conn, timeToLive, tunit);
- this.log = log;
}
public void markRouteComplete() {
@@ -77,8 +75,8 @@ class CPoolEntry extends PoolEntry<HttpR
@Override
public boolean isExpired(final long now) {
final boolean expired = super.isExpired(now);
- if (expired && this.log.isDebugEnabled()) {
- this.log.debug("Connection " + this + " expired @ " + new Date(getExpiry()));
+ if (expired && Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Connection " + this + " expired @ " + new Date(getExpiry()));
}
return expired;
}
@@ -94,7 +92,7 @@ class CPoolEntry extends PoolEntry<HttpR
try {
closeConnection();
} catch (final IOException ex) {
- this.log.debug("I/O error closing connection", ex);
+ Log.d(tag, "I/O error closing connection", ex);
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParser.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParser.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParser.java Sat Dec 28 16:09:01 2013
@@ -29,8 +29,8 @@ package org.apache.http.impl.conn;
import java.io.IOException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpException;
import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseFactory;
@@ -58,7 +58,7 @@ import org.apache.http.util.CharArrayBuf
@NotThreadSafe
public class DefaultHttpResponseParser extends AbstractMessageParserHC4<HttpResponse> {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final HttpResponseFactory responseFactory;
private final CharArrayBuffer lineBuf;
@@ -151,8 +151,8 @@ public class DefaultHttpResponseParser e
throw new ProtocolException("The server failed to respond with a " +
"valid HTTP response");
}
- if (this.log.isDebugEnabled()) {
- this.log.debug("Garbage in response: " + this.lineBuf.toString());
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Garbage in response: " + this.lineBuf.toString());
}
count++;
} while(true);
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java Sat Dec 28 16:09:01 2013
@@ -34,8 +34,8 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Arrays;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpHost;
import org.apache.http.annotation.Immutable;
import org.apache.http.client.protocol.HttpClientContext;
@@ -58,7 +58,7 @@ class HttpClientConnectionOperator {
static final String SOCKET_FACTORY_REGISTRY = "http.socket-factory-registry";
- private final Log log = LogFactory.getLog(HttpClientConnectionManager.class);
+ private final String tag = getClass().getName();
private final Lookup<ConnectionSocketFactory> socketFactoryRegistry;
private final SchemePortResolver schemePortResolver;
@@ -123,8 +123,8 @@ class HttpClientConnectionOperator {
conn.bind(sock);
final InetSocketAddress remoteAddress = new InetSocketAddress(address, port);
- if (this.log.isDebugEnabled()) {
- this.log.debug("Connecting to " + remoteAddress);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Connecting to " + remoteAddress);
}
try {
sock.setSoTimeout(socketConfig.getSoTimeout());
@@ -158,8 +158,8 @@ class HttpClientConnectionOperator {
}
}
}
- if (this.log.isDebugEnabled()) {
- this.log.debug("Connect to " + remoteAddress + " timed out. " +
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Connect to " + remoteAddress + " timed out. " +
"Connection will be retried using another IP address");
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/InMemoryDnsResolver.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/InMemoryDnsResolver.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/InMemoryDnsResolver.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/InMemoryDnsResolver.java Sat Dec 28 16:09:01 2013
@@ -32,8 +32,8 @@ import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.conn.DnsResolver;
import org.apache.http.util.Args;
@@ -44,8 +44,7 @@ import org.apache.http.util.Args;
*/
public class InMemoryDnsResolver implements DnsResolver {
- /** Logger associated to this class. */
- private final Log log = LogFactory.getLog(InMemoryDnsResolver.class);
+ private final String tag = getClass().getName();
/**
* In-memory collection that will hold the associations between a host name
@@ -82,8 +81,8 @@ public class InMemoryDnsResolver impleme
*/
public InetAddress[] resolve(final String host) throws UnknownHostException {
final InetAddress[] resolvedAddresses = dnsMap.get(host);
- if (log.isInfoEnabled()) {
- log.info("Resolving " + host + " to " + Arrays.deepToString(resolvedAddresses));
+ if (Log.isLoggable(tag, Log.INFO)) {
+ Log.i(tag, "Resolving " + host + " to " + Arrays.deepToString(resolvedAddresses));
}
if(resolvedAddresses == null){
throw new UnknownHostException(host + " cannot be resolved");
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java Sat Dec 28 16:09:01 2013
@@ -27,7 +27,7 @@
package org.apache.http.impl.conn;
-import org.apache.commons.logging.Log;
+import android.util.Log;
import org.apache.http.Header;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
@@ -47,15 +47,12 @@ import java.nio.charset.CharsetEncoder;
@NotThreadSafe
class LoggingManagedHttpClientConnection extends DefaultManagedHttpClientConnection {
- private final Log log;
- private final Log headerlog;
+ private final static String tag = ManagedHttpClientConnectionFactory.class.getName();
+ private final static String headertag = "org.apache.http.headers";
private final WireHC4 wire;
public LoggingManagedHttpClientConnection(
final String id,
- final Log log,
- final Log headerlog,
- final Log wirelog,
final int buffersize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
@@ -68,23 +65,21 @@ class LoggingManagedHttpClientConnection
super(id, buffersize, fragmentSizeHint, chardecoder, charencoder,
constraints, incomingContentStrategy, outgoingContentStrategy,
requestWriterFactory, responseParserFactory);
- this.log = log;
- this.headerlog = headerlog;
- this.wire = new WireHC4(wirelog, id);
+ this.wire = new WireHC4(id);
}
@Override
public void close() throws IOException {
- if (this.log.isDebugEnabled()) {
- this.log.debug(getId() + ": Close connection");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, getId() + ": Close connection");
}
super.close();
}
@Override
public void shutdown() throws IOException {
- if (this.log.isDebugEnabled()) {
- this.log.debug(getId() + ": Shutdown connection");
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, getId() + ": Shutdown connection");
}
super.shutdown();
}
@@ -109,22 +104,22 @@ class LoggingManagedHttpClientConnection
@Override
protected void onResponseReceived(final HttpResponse response) {
- if (response != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(getId() + " << " + response.getStatusLine().toString());
+ if (response != null && Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(headertag, getId() + " << " + response.getStatusLine().toString());
final Header[] headers = response.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(getId() + " << " + header.toString());
+ Log.d(headertag, getId() + " << " + header.toString());
}
}
}
@Override
protected void onRequestSubmitted(final HttpRequest request) {
- if (request != null && this.headerlog.isDebugEnabled()) {
- this.headerlog.debug(getId() + " >> " + request.getRequestLine().toString());
+ if (request != null && Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(headertag, getId() + " >> " + request.getRequestLine().toString());
final Header[] headers = request.getAllHeaders();
for (final Header header : headers) {
- this.headerlog.debug(getId() + " >> " + header.toString());
+ Log.d(headertag, getId() + " >> " + header.toString());
}
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java Sat Dec 28 16:09:01 2013
@@ -33,8 +33,6 @@ import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.Immutable;
@@ -58,10 +56,6 @@ public class ManagedHttpClientConnection
public static final ManagedHttpClientConnectionFactory INSTANCE = new ManagedHttpClientConnectionFactory();
- private final Log log = LogFactory.getLog(DefaultManagedHttpClientConnection.class);
- private final Log headerlog = LogFactory.getLog("org.apache.http.headers");
- private final Log wirelog = LogFactory.getLog("org.apache.http.wire");
-
private final HttpMessageWriterFactory<HttpRequest> requestWriterFactory;
private final HttpMessageParserFactory<HttpResponse> responseParserFactory;
@@ -104,9 +98,6 @@ public class ManagedHttpClientConnection
final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncrement());
return new LoggingManagedHttpClientConnection(
id,
- log,
- headerlog,
- wirelog,
cconfig.getBufferSize(),
cconfig.getFragmentSizeHint(),
chardecoder,
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java Sat Dec 28 16:09:01 2013
@@ -36,8 +36,8 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpClientConnection;
import org.apache.http.HttpHost;
import org.apache.http.annotation.ThreadSafe;
@@ -86,7 +86,7 @@ import org.apache.http.util.Asserts;
public class PoolingHttpClientConnectionManager
implements HttpClientConnectionManager, ConnPoolControl<HttpRoute>, Closeable {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final ConfigData configData;
private final CPool pool;
@@ -211,8 +211,8 @@ public class PoolingHttpClientConnection
final HttpRoute route,
final Object state) {
Args.notNull(route, "HTTP route");
- if (this.log.isDebugEnabled()) {
- this.log.debug("Connection request: " + format(route, state) + formatStats(route));
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Connection request: " + format(route, state) + formatStats(route));
}
final Future<CPoolEntry> future = this.pool.lease(route, state, null);
return new ConnectionRequest() {
@@ -242,8 +242,8 @@ public class PoolingHttpClientConnection
throw new InterruptedException();
}
Asserts.check(entry.getConnection() != null, "Pool entry with no connection");
- if (this.log.isDebugEnabled()) {
- this.log.debug("Connection leased: " + format(entry) + formatStats(entry.getRoute()));
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Connection leased: " + format(entry) + formatStats(entry.getRoute()));
}
return CPoolProxy.newProxy(entry);
} catch (final TimeoutException ex) {
@@ -266,20 +266,20 @@ public class PoolingHttpClientConnection
if (conn.isOpen()) {
entry.setState(state);
entry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS);
- if (this.log.isDebugEnabled()) {
+ if (Log.isLoggable(tag, Log.DEBUG)) {
final String s;
if (keepalive > 0) {
s = "for " + (double) keepalive / 1000 + " seconds";
} else {
s = "indefinitely";
}
- this.log.debug("Connection " + format(entry) + " can be kept alive " + s);
+ Log.d(tag, "Connection " + format(entry) + " can be kept alive " + s);
}
}
} finally {
this.pool.release(entry, conn.isOpen() && entry.isRouteComplete());
- if (this.log.isDebugEnabled()) {
- this.log.debug("Connection released: " + format(entry) + formatStats(entry.getRoute()));
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Connection released: " + format(entry) + formatStats(entry.getRoute()));
}
}
}
@@ -342,24 +342,24 @@ public class PoolingHttpClientConnection
}
public void shutdown() {
- this.log.debug("Connection manager is shutting down");
+ Log.d(tag, "Connection manager is shutting down");
try {
this.pool.shutdown();
} catch (final IOException ex) {
- this.log.debug("I/O exception shutting down connection manager", ex);
+ Log.d(tag, "I/O exception shutting down connection manager", ex);
}
- this.log.debug("Connection manager shut down");
+ Log.d(tag, "Connection manager shut down");
}
public void closeIdleConnections(final long idleTimeout, final TimeUnit tunit) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Closing connections idle longer than " + idleTimeout + " " + tunit);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Closing connections idle longer than " + idleTimeout + " " + tunit);
}
this.pool.closeIdle(idleTimeout, tunit);
}
public void closeExpiredConnections() {
- this.log.debug("Closing expired connections");
+ Log.d(tag, "Closing expired connections");
this.pool.closeExpired();
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/WireHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/WireHC4.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/WireHC4.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/conn/WireHC4.java Sat Dec 28 16:09:01 2013
@@ -30,7 +30,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import org.apache.commons.logging.Log;
+import android.util.Log;
import org.apache.http.annotation.Immutable;
import org.apache.http.util.Args;
@@ -43,21 +43,16 @@ import org.apache.http.util.Args;
@Immutable
public class WireHC4 {
- private final Log log;
+ private static final String tag = "org.apache.http.wire";
private final String id;
/**
* @since 4.3
*/
- public WireHC4(final Log log, final String id) {
- this.log = log;
+ public WireHC4(final String id) {
this.id = id;
}
- public WireHC4(final Log log) {
- this(log, "");
- }
-
private void wire(final String header, final InputStream instream)
throws IOException {
final StringBuilder buffer = new StringBuilder();
@@ -69,7 +64,7 @@ public class WireHC4 {
buffer.append("[\\n]\"");
buffer.insert(0, "\"");
buffer.insert(0, header);
- log.debug(id + " " + buffer.toString());
+ Log.d(tag, id + " " + buffer.toString());
buffer.setLength(0);
} else if ((ch < 32) || (ch > 127)) {
buffer.append("[0x");
@@ -83,13 +78,13 @@ public class WireHC4 {
buffer.append('\"');
buffer.insert(0, '\"');
buffer.insert(0, header);
- log.debug(id + " " + buffer.toString());
+ Log.d(tag, id + " " + buffer.toString());
}
}
public boolean enabled() {
- return log.isDebugEnabled();
+ return Log.isLoggable(tag, Log.DEBUG);
}
public void output(final InputStream outstream)
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java Sat Dec 28 16:09:01 2013
@@ -31,7 +31,7 @@ import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.logging.Log;
+import android.util.Log;
import org.apache.http.HttpClientConnection;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.concurrent.Cancellable;
@@ -46,7 +46,7 @@ import org.apache.http.conn.HttpClientCo
@ThreadSafe
class ConnectionHolder implements ConnectionReleaseTrigger, Cancellable, Closeable {
- private final Log log;
+ private final String tag;
private final HttpClientConnectionManager manager;
private final HttpClientConnection managedConn;
@@ -58,11 +58,11 @@ class ConnectionHolder implements Connec
private volatile boolean released;
public ConnectionHolder(
- final Log log,
+ final String tag,
final HttpClientConnectionManager manager,
final HttpClientConnection managedConn) {
super();
- this.log = log;
+ this.tag = tag;
this.manager = manager;
this.managedConn = managedConn;
}
@@ -102,10 +102,10 @@ class ConnectionHolder implements Connec
} else {
try {
this.managedConn.close();
- log.debug("Connection discarded");
+ Log.d(tag, "Connection discarded");
} catch (final IOException ex) {
- if (this.log.isDebugEnabled()) {
- this.log.debug(ex.getMessage(), ex);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, ex.getMessage(), ex);
}
} finally {
this.manager.releaseConnection(
@@ -123,10 +123,10 @@ class ConnectionHolder implements Connec
this.released = true;
try {
this.managedConn.shutdown();
- log.debug("Connection discarded");
+ Log.d(tag, "Connection discarded");
} catch (final IOException ex) {
- if (this.log.isDebugEnabled()) {
- this.log.debug(ex.getMessage(), ex);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, ex.getMessage(), ex);
}
} finally {
this.manager.releaseConnection(
@@ -137,7 +137,7 @@ class ConnectionHolder implements Connec
public boolean cancel() {
final boolean alreadyReleased = this.released;
- log.debug("Cancelling request execution");
+ Log.d(tag, "Cancelling request execution");
abortConnection();
return !alreadyReleased;
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MainClientExec.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MainClientExec.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MainClientExec.java Sat Dec 28 16:09:01 2013
@@ -32,8 +32,8 @@ import java.io.InterruptedIOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.ConnectionReuseStrategy;
import org.apache.http.HttpClientConnection;
import org.apache.http.HttpEntity;
@@ -86,7 +86,7 @@ import org.apache.http.util.EntityUtilsH
@Immutable
public class MainClientExec implements ClientExecChain {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final HttpRequestExecutor requestExecutor;
private final HttpClientConnectionManager connManager;
@@ -186,15 +186,15 @@ public class MainClientExec implements C
if (config.isStaleConnectionCheckEnabled()) {
// validate connection
if (managedConn.isOpen()) {
- this.log.debug("Stale connection check");
+ Log.d(tag, "Stale connection check");
if (managedConn.isStale()) {
- this.log.debug("Stale connection detected");
+ Log.d(tag, "Stale connection detected");
managedConn.close();
}
}
}
- final ConnectionHolder connHolder = new ConnectionHolder(this.log, this.connManager, managedConn);
+ final ConnectionHolder connHolder = new ConnectionHolder(this.tag, this.connManager, managedConn);
try {
if (execAware != null) {
execAware.setCancellable(connHolder);
@@ -213,12 +213,12 @@ public class MainClientExec implements C
}
if (!managedConn.isOpen()) {
- this.log.debug("Opening connection " + route);
+ Log.d(tag, "Opening connection " + route);
try {
establishRoute(proxyAuthState, managedConn, route, request, context);
} catch (final TunnelRefusedException ex) {
- if (this.log.isDebugEnabled()) {
- this.log.debug(ex.getMessage());
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, ex.getMessage());
}
response = ex.getResponse();
break;
@@ -233,19 +233,19 @@ public class MainClientExec implements C
throw new RequestAbortedException("Request aborted");
}
- if (this.log.isDebugEnabled()) {
- this.log.debug("Executing request " + request.getRequestLine());
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Executing request " + request.getRequestLine());
}
if (!request.containsHeader(AUTH.WWW_AUTH_RESP)) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Target auth state: " + targetAuthState.getState());
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Target auth state: " + targetAuthState.getState());
}
this.authenticator.generateAuthResponse(request, targetAuthState, context);
}
if (!request.containsHeader(AUTH.PROXY_AUTH_RESP) && !route.isTunnelled()) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Proxy auth state: " + proxyAuthState.getState());
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Proxy auth state: " + proxyAuthState.getState());
}
this.authenticator.generateAuthResponse(request, proxyAuthState, context);
}
@@ -256,14 +256,14 @@ public class MainClientExec implements C
if (reuseStrategy.keepAlive(response, context)) {
// Set the idle duration of this connection
final long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
- if (this.log.isDebugEnabled()) {
+ if (Log.isLoggable(tag, Log.DEBUG)) {
final String s;
if (duration > 0) {
s = "for " + duration + " " + TimeUnit.MILLISECONDS;
} else {
s = "indefinitely";
}
- this.log.debug("Connection can be kept alive " + s);
+ Log.d(tag, "Connection can be kept alive " + s);
}
connHolder.setValidFor(duration, TimeUnit.MILLISECONDS);
connHolder.markReusable();
@@ -282,13 +282,13 @@ public class MainClientExec implements C
if (proxyAuthState.getState() == AuthProtocolState.SUCCESS
&& proxyAuthState.getAuthScheme() != null
&& proxyAuthState.getAuthScheme().isConnectionBased()) {
- this.log.debug("Resetting proxy auth state");
+ Log.d(tag, "Resetting proxy auth state");
proxyAuthState.reset();
}
if (targetAuthState.getState() == AuthProtocolState.SUCCESS
&& targetAuthState.getAuthScheme() != null
&& targetAuthState.getAuthScheme().isConnectionBased()) {
- this.log.debug("Resetting target auth state");
+ Log.d(tag, "Resetting target auth state");
targetAuthState.reset();
}
}
@@ -373,7 +373,7 @@ public class MainClientExec implements C
case HttpRouteDirector.TUNNEL_TARGET: {
final boolean secure = createTunnelToTarget(
proxyAuthState, managedConn, route, request, context);
- this.log.debug("Tunnel to target created.");
+ Log.d(tag, "Tunnel to target created.");
tracker.tunnelTarget(secure);
} break;
@@ -384,7 +384,7 @@ public class MainClientExec implements C
// fact: Source -> P1 -> Target (2 hops)
final int hop = fact.getHopCount()-1; // the hop to establish
final boolean secure = createTunnelToProxy(route, hop, context);
- this.log.debug("Tunnel to proxy created.");
+ Log.d(tag, "Tunnel to proxy created.");
tracker.tunnelProxy(route.getHopTarget(hop), secure);
} break;
@@ -461,7 +461,7 @@ public class MainClientExec implements C
this.proxyAuthStrategy, proxyAuthState, context)) {
// Retry request
if (this.reuseStrategy.keepAlive(response, context)) {
- this.log.debug("Connection kept alive");
+ Log.d(tag, "Connection kept alive");
// Consume response content
final HttpEntity entity = response.getEntity();
EntityUtilsHC4.consume(entity);
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java Sat Dec 28 16:09:01 2013
@@ -33,8 +33,8 @@ import java.net.URI;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.ConnectionReuseStrategy;
import org.apache.http.HttpClientConnection;
import org.apache.http.HttpEntity;
@@ -76,7 +76,7 @@ import org.apache.http.util.VersionInfoH
@Immutable
public class MinimalClientExec implements ClientExecChain {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final HttpRequestExecutor requestExecutor;
private final HttpClientConnectionManager connManager;
@@ -141,7 +141,7 @@ public class MinimalClientExec implement
throw new RequestAbortedException("Request execution failed", cause);
}
- final ConnectionHolder releaseTrigger = new ConnectionHolder(log, connManager, managedConn);
+ final ConnectionHolder releaseTrigger = new ConnectionHolder(getClass().getName(), connManager, managedConn);
try {
if (execAware != null) {
if (execAware.isAborted()) {
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java Sat Dec 28 16:09:01 2013
@@ -31,8 +31,8 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@@ -71,7 +71,7 @@ import org.apache.http.util.Args;
@SuppressWarnings("deprecation")
public class ProtocolExec implements ClientExecChain {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final ClientExecChain requestExecutor;
private final HttpProcessor httpProcessor;
@@ -131,8 +131,8 @@ public class ProtocolExec implements Cli
try {
uri = URI.create(uriString);
} catch (final IllegalArgumentException ex) {
- if (this.log.isDebugEnabled()) {
- this.log.debug("Unable to parse '" + uriString + "' as a valid URI; " +
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Unable to parse '" + uriString + "' as a valid URI; " +
"request URI and Host header may be inconsistent", ex);
}
}
@@ -152,8 +152,8 @@ public class ProtocolExec implements Cli
virtualHost = new HttpHost(virtualHost.getHostName(), port,
virtualHost.getSchemeName());
}
- if (this.log.isDebugEnabled()) {
- this.log.debug("Using virtual host" + virtualHost);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Using virtual host" + virtualHost);
}
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RedirectExec.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RedirectExec.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RedirectExec.java Sat Dec 28 16:09:01 2013
@@ -31,8 +31,8 @@ import java.io.IOException;
import java.net.URI;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
@@ -67,7 +67,7 @@ import org.apache.http.util.EntityUtilsH
@ThreadSafe
public class RedirectExec implements ClientExecChain {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final ClientExecChain requestExecutor;
private final RedirectStrategy redirectStrategy;
@@ -139,22 +139,22 @@ public class RedirectExec implements Cli
if (!currentRoute.getTargetHost().equals(newTarget)) {
final AuthStateHC4 targetAuthState = context.getTargetAuthState();
if (targetAuthState != null) {
- this.log.debug("Resetting target auth state");
+ Log.d(tag, "Resetting target auth state");
targetAuthState.reset();
}
final AuthStateHC4 proxyAuthState = context.getProxyAuthState();
if (proxyAuthState != null) {
final AuthScheme authScheme = proxyAuthState.getAuthScheme();
if (authScheme != null && authScheme.isConnectionBased()) {
- this.log.debug("Resetting proxy auth state");
+ Log.d(tag, "Resetting proxy auth state");
proxyAuthState.reset();
}
}
}
currentRoute = this.routePlanner.determineRoute(newTarget, currentRequest, context);
- if (this.log.isDebugEnabled()) {
- this.log.debug("Redirecting to '" + uri + "' via " + currentRoute);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Redirecting to '" + uri + "' via " + currentRoute);
}
EntityUtilsHC4.consume(response.getEntity());
response.close();
@@ -173,7 +173,7 @@ public class RedirectExec implements Cli
try {
EntityUtilsHC4.consume(response.getEntity());
} catch (final IOException ioex) {
- this.log.debug("I/O error while releasing connection", ioex);
+ Log.d(tag, "I/O error while releasing connection", ioex);
} finally {
response.close();
}