hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1574881 - in /httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http: client/protocol/ impl/auth/ impl/client/ impl/conn/ impl/execchain/
Date Thu, 06 Mar 2014 13:55:19 GMT
Author: olegk
Date: Thu Mar  6 13:55:18 2014
New Revision: 1574881

URL: http://svn.apache.org/r1574881
Log:
#isLoggable check for all debug logs; use verbose priority for wire logging

Modified:
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/WireHC4.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java
    httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAddCookiesHC4.java
Thu Mar  6 13:55:18 2014
@@ -88,28 +88,36 @@ public class RequestAddCookiesHC4 implem
         // Obtain cookie store
         final CookieStore cookieStore = clientContext.getCookieStore();
         if (cookieStore == null) {
-            Log.d(TAG, "Cookie store not specified in HTTP context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                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) {
-            Log.d(TAG, "CookieSpec registry not specified in HTTP context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                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) {
-            Log.d(TAG, "Target host not set in the context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Target host not set in the context");
+            }
             return;
         }
 
         // Obtain the route (required)
         final RouteInfo route = clientContext.getHttpRoute();
         if (route == null) {
-            Log.d(TAG, "Connection route not set in the context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Connection route not set in the context");
+            }
             return;
         }
 

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
Thu Mar  6 13:55:18 2014
@@ -72,13 +72,17 @@ public class RequestAuthCache implements
 
         final AuthCache authCache = clientContext.getAuthCache();
         if (authCache == null) {
-            Log.d(TAG, "Auth cache not set in the context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Auth cache not set in the context");
+            }
             return;
         }
 
         final CredentialsProvider credsProvider = clientContext.getCredentialsProvider();
         if (credsProvider == null) {
-            Log.d(TAG, "Credentials provider not set in the context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Credentials provider not set in the context");
+            }
             return;
         }
 
@@ -130,7 +134,9 @@ public class RequestAuthCache implements
             }
             authState.update(authScheme, creds);
         } else {
-            Log.d(TAG, "No credentials for preemptive authentication");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "No credentials for preemptive authentication");
+            }
         }
     }
 

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
Thu Mar  6 13:55:18 2014
@@ -73,7 +73,9 @@ public class RequestClientConnControl im
         // Obtain the client connection (required)
         final RouteInfo route = clientContext.getHttpRoute();
         if (route == null) {
-            Log.d(TAG, "Connection route not set in the context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Connection route not set in the context");
+            }
             return;
         }
 

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/client/protocol/ResponseProcessCookiesHC4.java
Thu Mar  6 13:55:18 2014
@@ -72,19 +72,25 @@ public class ResponseProcessCookiesHC4 i
         // Obtain actual CookieSpec instance
         final CookieSpec cookieSpec = clientContext.getCookieSpec();
         if (cookieSpec == null) {
-            Log.d(TAG, "Cookie spec not specified in HTTP context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Cookie spec not specified in HTTP context");
+            }
             return;
         }
         // Obtain cookie store
         final CookieStore cookieStore = clientContext.getCookieStore();
         if (cookieStore == null) {
-            Log.d(TAG, "Cookie store not specified in HTTP context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Cookie store not specified in HTTP context");
+            }
             return;
         }
         // Obtain actual CookieOrigin instance
         final CookieOrigin cookieOrigin = clientContext.getCookieOrigin();
         if (cookieOrigin == null) {
-            Log.d(TAG, "Cookie origin not specified in HTTP context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Cookie origin not specified in HTTP context");
+            }
             return;
         }
         HeaderIterator it = response.headerIterator(SM.SET_COOKIE);

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java
Thu Mar  6 13:55:18 2014
@@ -73,7 +73,9 @@ public class HttpAuthenticator {
             final AuthStateHC4 authState,
             final HttpContext context) {
         if (authStrategy.isAuthenticationRequested(host, response, context)) {
-            Log.d(TAG, "Authentication required");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Authentication required");
+            }
             if (authState.getState() == AuthProtocolState.SUCCESS) {
                 authStrategy.authFailed(host, authState.getAuthScheme(), context);
             }
@@ -82,7 +84,9 @@ public class HttpAuthenticator {
             switch (authState.getState()) {
             case CHALLENGED:
             case HANDSHAKE:
-                Log.d(TAG, "Authentication succeeded");
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG, "Authentication succeeded");
+                }
                 authState.setState(AuthProtocolState.SUCCESS);
                 authStrategy.authSucceeded(host, authState.getAuthScheme(), context);
                 break;
@@ -107,7 +111,9 @@ public class HttpAuthenticator {
             }
             final Map<String, Header> challenges = authStrategy.getChallenges(host,
response, context);
             if (challenges.isEmpty()) {
-                Log.d(TAG, "Response contains no authentication challenges");
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG, "Response contains no authentication challenges");
+                }
                 return false;
             }
 
@@ -121,7 +127,9 @@ public class HttpAuthenticator {
             case CHALLENGED:
             case HANDSHAKE:
                 if (authScheme == null) {
-                    Log.d(TAG, "Auth scheme is null");
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, "Auth scheme is null");
+                    }
                     authStrategy.authFailed(host, null, context);
                     authState.reset();
                     authState.setState(AuthProtocolState.FAILURE);
@@ -132,10 +140,14 @@ public class HttpAuthenticator {
                     final String id = authScheme.getSchemeName();
                     final Header challenge = challenges.get(id.toLowerCase(Locale.US));
                     if (challenge != null) {
-                        Log.d(TAG, "Authorization challenge processed");
+                        if (Log.isLoggable(TAG, Log.DEBUG)) {
+                            Log.d(TAG, "Authorization challenge processed");
+                        }
                         authScheme.processChallenge(challenge);
                         if (authScheme.isComplete()) {
-                            Log.d(TAG, "Authentication failed");
+                            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                Log.d(TAG, "Authentication failed");
+                            }
                             authStrategy.authFailed(host, authState.getAuthScheme(), context);
                             authState.reset();
                             authState.setState(AuthProtocolState.FAILURE);

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
Thu Mar  6 13:55:18 2014
@@ -144,12 +144,16 @@ abstract class AuthenticationStrategyImp
         final Queue<AuthOption> options = new LinkedList<AuthOption>();
         final Lookup<AuthSchemeProvider> registry = clientContext.getAuthSchemeRegistry();
         if (registry == null) {
-            Log.d(TAG, "Auth scheme registry not set in the context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Auth scheme registry not set in the context");
+            }
             return options;
         }
         final CredentialsProvider credsProvider = clientContext.getCredentialsProvider();
         if (credsProvider == null) {
-            Log.d(TAG, "Credentials provider not set in the context");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Credentials provider not set in the context");
+            }
             return options;
         }
         final RequestConfig config = clientContext.getRequestConfig();

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
Thu Mar  6 13:55:18 2014
@@ -204,7 +204,9 @@ public class BasicHttpClientConnectionMa
 
     private void closeConnection() {
         if (this.conn != null) {
-            Log.d(TAG, "Closing connection");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Closing connection");
+            }
             try {
                 this.conn.close();
             } catch (final IOException iox) {
@@ -218,7 +220,9 @@ public class BasicHttpClientConnectionMa
 
     private void shutdownConnection() {
         if (this.conn != null) {
-            Log.d(TAG, "Shutting down connection");
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "Shutting down connection");
+            }
             try {
                 this.conn.shutdown();
             } catch (final IOException iox) {

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
Thu Mar  6 13:55:18 2014
@@ -48,7 +48,7 @@ import java.nio.charset.CharsetEncoder;
 class LoggingManagedHttpClientConnection extends DefaultManagedHttpClientConnection {
 
     private final static String TAG = "HttpClient";
-    private final static String HEADER_TAG = "headers";
+    private final static String HEADER_TAG = "Headers";
 
     private final WireHC4 wire;
 

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
Thu Mar  6 13:55:18 2014
@@ -342,13 +342,19 @@ public class PoolingHttpClientConnection
     }
 
     public void shutdown() {
-        Log.d(TAG, "Connection manager is shutting down");
+        if (Log.isLoggable(TAG, Log.DEBUG)) {
+            Log.d(TAG, "Connection manager is shutting down");
+        }
         try {
             this.pool.shutdown();
         } catch (final IOException ex) {
-            Log.d(TAG, "I/O exception shutting down connection manager", ex);
+            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                Log.d(TAG, "I/O exception shutting down connection manager", ex);
+            }
+        }
+        if (Log.isLoggable(TAG, Log.DEBUG)) {
+            Log.d(TAG, "Connection manager shut down");
         }
-        Log.d(TAG, "Connection manager shut down");
     }
 
     public void closeIdleConnections(final long idleTimeout, final TimeUnit tunit) {
@@ -359,7 +365,9 @@ public class PoolingHttpClientConnection
     }
 
     public void closeExpiredConnections() {
-        Log.d(TAG, "Closing expired connections");
+        if (Log.isLoggable(TAG, Log.DEBUG)) {
+            Log.d(TAG, "Closing expired connections");
+        }
         this.pool.closeExpired();
     }
 

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/WireHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/WireHC4.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/WireHC4.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/conn/WireHC4.java
Thu Mar  6 13:55:18 2014
@@ -43,7 +43,7 @@ import org.apache.http.util.Args;
 @Immutable
 public class WireHC4 {
 
-    private final static String TAG = "wire";
+    private final static String TAG = "Wire";
     private final String id;
 
     /**
@@ -64,7 +64,7 @@ public class WireHC4 {
                     buffer.append("[\\n]\"");
                     buffer.insert(0, "\"");
                     buffer.insert(0, header);
-                    Log.d(TAG, id + " " + buffer.toString());
+                    Log.v(TAG, id + " " + buffer.toString());
                     buffer.setLength(0);
             } else if ((ch < 32) || (ch > 127)) {
                 buffer.append("[0x");
@@ -78,13 +78,13 @@ public class WireHC4 {
             buffer.append('\"');
             buffer.insert(0, '\"');
             buffer.insert(0, header);
-            Log.d(TAG, id + " " + buffer.toString());
+            Log.v(TAG, id + " " + buffer.toString());
         }
     }
 
 
     public boolean enabled() {
-        return Log.isLoggable(TAG, Log.DEBUG);
+        return Log.isLoggable(TAG, Log.VERBOSE);
     }
 
     public void output(final InputStream outstream)

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
Thu Mar  6 13:55:18 2014
@@ -100,7 +100,9 @@ class ConnectionHolder implements Connec
             } else {
                 try {
                     this.managedConn.close();
-                    Log.d(TAG, "Connection discarded");
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, "Connection discarded");
+                    }
                 } catch (final IOException ex) {
                     if (Log.isLoggable(TAG, Log.DEBUG)) {
                         Log.d(TAG, ex.getMessage(), ex);
@@ -121,7 +123,9 @@ class ConnectionHolder implements Connec
             this.released = true;
             try {
                 this.managedConn.shutdown();
-                Log.d(TAG, "Connection discarded");
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG, "Connection discarded");
+                }
             } catch (final IOException ex) {
                 if (Log.isLoggable(TAG, Log.DEBUG)) {
                     Log.d(TAG, ex.getMessage(), ex);
@@ -135,7 +139,9 @@ class ConnectionHolder implements Connec
 
     public boolean cancel() {
         final boolean alreadyReleased = this.released;
-        Log.d(TAG, "Cancelling request execution");
+        if (Log.isLoggable(TAG, Log.DEBUG)) {
+            Log.d(TAG, "Cancelling request execution");
+        }
         abortConnection();
         return !alreadyReleased;
     }

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
Thu Mar  6 13:55:18 2014
@@ -187,9 +187,13 @@ public class MainClientExec implements C
         if (config.isStaleConnectionCheckEnabled()) {
             // validate connection
             if (managedConn.isOpen()) {
-                Log.d(TAG, "Stale connection check");
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG, "Stale connection check");
+                }
                 if (managedConn.isStale()) {
-                    Log.d(TAG, "Stale connection detected");
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, "Stale connection detected");
+                    }
                     managedConn.close();
                 }
             }
@@ -214,7 +218,9 @@ public class MainClientExec implements C
                 }
 
                 if (!managedConn.isOpen()) {
-                    Log.d(TAG, "Opening connection " + route);
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, "Opening connection " + route);
+                    }
                     try {
                         establishRoute(proxyAuthState, managedConn, route, request, context);
                     } catch (final TunnelRefusedException ex) {
@@ -283,13 +289,17 @@ public class MainClientExec implements C
                         if (proxyAuthState.getState() == AuthProtocolState.SUCCESS
                                 && proxyAuthState.getAuthScheme() != null
                                 && proxyAuthState.getAuthScheme().isConnectionBased())
{
-                            Log.d(TAG, "Resetting proxy auth state");
+                            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                Log.d(TAG, "Resetting proxy auth state");
+                            }
                             proxyAuthState.reset();
                         }
                         if (targetAuthState.getState() == AuthProtocolState.SUCCESS
                                 && targetAuthState.getAuthScheme() != null
                                 && targetAuthState.getAuthScheme().isConnectionBased())
{
-                            Log.d(TAG, "Resetting target auth state");
+                            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                Log.d(TAG, "Resetting target auth state");
+                            }
                             targetAuthState.reset();
                         }
                     }
@@ -379,7 +389,9 @@ public class MainClientExec implements C
             case HttpRouteDirector.TUNNEL_TARGET: {
                 final boolean secure = createTunnelToTarget(
                         proxyAuthState, managedConn, route, request, context);
-                Log.d(TAG, "Tunnel to target created.");
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG, "Tunnel to target created.");
+                }
                 tracker.tunnelTarget(secure);
             }   break;
 
@@ -390,7 +402,9 @@ 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);
-                Log.d(TAG, "Tunnel to proxy created.");
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG, "Tunnel to proxy created.");
+                }
                 tracker.tunnelProxy(route.getHopTarget(hop), secure);
             }   break;
 
@@ -467,7 +481,9 @@ public class MainClientExec implements C
                             this.proxyAuthStrategy, proxyAuthState, context)) {
                         // Retry request
                         if (this.reuseStrategy.keepAlive(response, context)) {
-                            Log.d(TAG, "Connection kept alive");
+                            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                Log.d(TAG, "Connection kept alive");
+                            }
                             // Consume response content
                             final HttpEntity entity = response.getEntity();
                             EntityUtilsHC4.consume(entity);

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
Thu Mar  6 13:55:18 2014
@@ -139,14 +139,18 @@ public class RedirectExec implements Cli
                     if (!currentRoute.getTargetHost().equals(newTarget)) {
                         final AuthStateHC4 targetAuthState = context.getTargetAuthState();
                         if (targetAuthState != null) {
-                            Log.d(TAG, "Resetting target auth state");
+                            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                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())
{
-                                Log.d(TAG, "Resetting proxy auth state");
+                                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                    Log.d(TAG, "Resetting proxy auth state");
+                                }
                                 proxyAuthState.reset();
                             }
                         }

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java
Thu Mar  6 13:55:18 2014
@@ -86,7 +86,9 @@ public class RetryExec implements Client
                 return this.requestExecutor.execute(route, request, context, execAware);
             } catch (final IOException ex) {
                 if (execAware != null && execAware.isAborted()) {
-                    Log.d(TAG, "Request has been aborted");
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, "Request has been aborted");
+                    }
                     throw ex;
                 }
                 if (retryHandler.retryRequest(ex, execCount, context)) {
@@ -101,7 +103,9 @@ public class RetryExec implements Client
                         Log.d(TAG, ex.getMessage(), ex);
                     }
                     if (!Proxies.isRepeatable(request)) {
-                        Log.d(TAG, "Cannot retry non-repeatable request");
+                        if (Log.isLoggable(TAG, Log.DEBUG)) {
+                            Log.d(TAG, "Cannot retry non-repeatable request");
+                        }
                         final NonRepeatableRequestException nreex = new NonRepeatableRequestException(
                                 "Cannot retry request with a non-repeatable request entity");
                         nreex.initCause(ex);

Modified: httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java?rev=1574881&r1=1574880&r2=1574881&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.3-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
Thu Mar  6 13:55:18 2014
@@ -87,7 +87,9 @@ public class ServiceUnavailableRetryExec
                     final long nextInterval = this.retryStrategy.getRetryInterval();
                     if (nextInterval > 0) {
                         try {
-                            Log.d(TAG, "Wait for " + nextInterval);
+                            if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                Log.d(TAG, "Wait for " + nextInterval);
+                            }
                             Thread.sleep(nextInterval);
                         } catch (final InterruptedException e) {
                             Thread.currentThread().interrupt();



Mime
View raw message