hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1616447 [2/2] - in /httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http: client/protocol/ conn/ssl/ impl/auth/ impl/client/ impl/conn/ impl/execchain/ impl/io/
Date Thu, 07 Aug 2014 09:18:07 GMT
Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
Thu Aug  7 09:18:06 2014
@@ -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;
@@ -87,7 +87,7 @@ import org.apache.http.util.EntityUtilsH
 @Immutable
 public class MainClientExec implements ClientExecChain {
 
-    private final Log log = LogFactory.getLog(getClass());
+    private final static String TAG = "HttpClient";
 
     private final HttpRequestExecutor requestExecutor;
     private final HttpClientConnectionManager connManager;
@@ -187,15 +187,19 @@ public class MainClientExec implements C
         if (config.isStaleConnectionCheckEnabled()) {
             // validate connection
             if (managedConn.isOpen()) {
-                this.log.debug("Stale connection check");
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG, "Stale connection check");
+                }
                 if (managedConn.isStale()) {
-                    this.log.debug("Stale connection detected");
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, "Stale connection detected");
+                    }
                     managedConn.close();
                 }
             }
         }
 
-        final ConnectionHolder connHolder = new ConnectionHolder(this.log, this.connManager,
managedConn);
+        final ConnectionHolder connHolder = new ConnectionHolder(this.connManager, managedConn);
         try {
             if (execAware != null) {
                 execAware.setCancellable(connHolder);
@@ -214,12 +218,14 @@ public class MainClientExec implements C
                 }
 
                 if (!managedConn.isOpen()) {
-                    this.log.debug("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) {
-                        if (this.log.isDebugEnabled()) {
-                            this.log.debug(ex.getMessage());
+                        if (Log.isLoggable(TAG, Log.DEBUG)) {
+                            Log.d(TAG, ex.getMessage());
                         }
                         response = ex.getResponse();
                         break;
@@ -234,19 +240,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);
                 }
@@ -257,14 +263,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();
@@ -283,13 +289,17 @@ public class MainClientExec implements C
                         if (proxyAuthState.getState() == AuthProtocolState.SUCCESS
                                 && proxyAuthState.getAuthScheme() != null
                                 && proxyAuthState.getAuthScheme().isConnectionBased())
{
-                            this.log.debug("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())
{
-                            this.log.debug("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);
-                this.log.debug("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);
-                this.log.debug("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)) {
-                            this.log.debug("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.5-android/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
Thu Aug  7 09:18:06 2014
@@ -34,8 +34,6 @@ import java.net.URISyntaxException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpClientConnection;
 import org.apache.http.HttpEntity;
@@ -80,8 +78,6 @@ import org.apache.http.util.VersionInfoH
 @Immutable
 public class MinimalClientExec implements ClientExecChain {
 
-    private final Log log = LogFactory.getLog(getClass());
-
     private final HttpRequestExecutor requestExecutor;
     private final HttpClientConnectionManager connManager;
     private final ConnectionReuseStrategy reuseStrategy;
@@ -166,7 +162,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(connManager, managedConn);
         try {
             if (execAware != null) {
                 if (execAware.isAborted()) {

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
Thu Aug  7 09:18:06 2014
@@ -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;
@@ -72,7 +72,7 @@ import org.apache.http.util.Args;
 @SuppressWarnings("deprecation")
 public class ProtocolExec implements ClientExecChain {
 
-    private final Log log = LogFactory.getLog(getClass());
+    private final static String TAG = "HttpClient";
 
     private final ClientExecChain requestExecutor;
     private final HttpProcessor httpProcessor;
@@ -132,8 +132,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);
                 }
             }
@@ -153,8 +153,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/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
Thu Aug  7 09:18:06 2014
@@ -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 static String TAG = "HttpClient";
 
     private final ClientExecChain requestExecutor;
     private final RedirectStrategy redirectStrategy;
@@ -139,22 +139,26 @@ 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");
+                            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())
{
-                                this.log.debug("Resetting proxy auth state");
+                                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                                    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 +177,9 @@ public class RedirectExec implements Cli
                 try {
                     EntityUtilsHC4.consume(response.getEntity());
                 } catch (final IOException ioex) {
-                    this.log.debug("I/O error while releasing connection", ioex);
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, "I/O error while releasing connection", ioex);
+                    }
                 } finally {
                     response.close();
                 }

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/RetryExec.java
Thu Aug  7 09:18:06 2014
@@ -29,8 +29,8 @@ package org.apache.http.impl.execchain;
 
 import java.io.IOException;
 
-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.NoHttpResponseException;
@@ -58,7 +58,7 @@ import org.apache.http.util.Args;
 @Immutable
 public class RetryExec implements ClientExecChain {
 
-    private final Log log = LogFactory.getLog(getClass());
+    private final static String TAG = "HttpClient";
 
     private final ClientExecChain requestExecutor;
     private final HttpRequestRetryHandler retryHandler;
@@ -86,29 +86,33 @@ public class RetryExec implements Client
                 return this.requestExecutor.execute(route, request, context, execAware);
             } catch (final IOException ex) {
                 if (execAware != null && execAware.isAborted()) {
-                    this.log.debug("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)) {
-                    if (this.log.isInfoEnabled()) {
-                        this.log.info("I/O exception ("+ ex.getClass().getName() +
+                    if (Log.isLoggable(TAG, Log.INFO)) {
+                        Log.i(TAG, "I/O exception ("+ ex.getClass().getName() +
                                 ") caught when processing request to "
                                 + route +
                                 ": "
                                 + ex.getMessage());
                     }
-                    if (this.log.isDebugEnabled()) {
-                        this.log.debug(ex.getMessage(), ex);
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, ex.getMessage(), ex);
                     }
                     if (!RequestEntityProxy.isRepeatable(request)) {
-                        this.log.debug("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);
                     }
                     request.setHeaders(origheaders);
-                    if (this.log.isInfoEnabled()) {
-                        this.log.info("Retrying request to " + route);
+                    if (Log.isLoggable(TAG, Log.INFO)) {
+                        Log.i(TAG, "Retrying request to " + route);
                     }
                 } else {
                     if (ex instanceof NoHttpResponseException) {

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
Thu Aug  7 09:18:06 2014
@@ -30,8 +30,8 @@ package org.apache.http.impl.execchain;
 import java.io.IOException;
 import java.io.InterruptedIOException;
 
-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.annotation.Immutable;
@@ -57,7 +57,7 @@ import org.apache.http.util.Args;
 @Immutable
 public class ServiceUnavailableRetryExec implements ClientExecChain {
 
-    private final Log log = LogFactory.getLog(getClass());
+    private final static String TAG = "HttpClient";
 
     private final ClientExecChain requestExecutor;
     private final ServiceUnavailableRetryStrategy retryStrategy;
@@ -87,7 +87,9 @@ public class ServiceUnavailableRetryExec
                     final long nextInterval = this.retryStrategy.getRetryInterval();
                     if (nextInterval > 0) {
                         try {
-                            this.log.trace("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();

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/AbstractMessageParserHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/AbstractMessageParserHC4.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/AbstractMessageParserHC4.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/AbstractMessageParserHC4.java
Thu Aug  7 09:18:06 2014
@@ -76,7 +76,7 @@ public abstract class AbstractMessagePar
      * @param parser the line parser.
      * @param params HTTP parameters.
      *
-     * @deprecated (4.3) use {@link AbstractMessageParserHC4#AbstractMessageParser(SessionInputBuffer,
+     * @deprecated (4.3) use {@link AbstractMessageParserHC4#AbstractMessageParserHC4(SessionInputBuffer,
      *   LineParser, MessageConstraints)}
      */
     @Deprecated

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/ChunkedOutputStreamHC4.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/ChunkedOutputStreamHC4.java?rev=1616447&r1=1616446&r2=1616447&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/ChunkedOutputStreamHC4.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/io/ChunkedOutputStreamHC4.java
Thu Aug  7 09:18:06 2014
@@ -67,7 +67,7 @@ public class ChunkedOutputStreamHC4 exte
      * @param bufferSize The minimum chunk size (excluding last chunk)
      * @throws IOException not thrown
      *
-     * @deprecated (4.3) use {@link ChunkedOutputStreamHC4#ChunkedOutputStream(int, SessionOutputBuffer)}
+     * @deprecated (4.3) use {@link ChunkedOutputStreamHC4#ChunkedOutputStreamHC4(int, SessionOutputBuffer)}
      */
     @Deprecated
     public ChunkedOutputStreamHC4(final SessionOutputBuffer out, final int bufferSize)
@@ -82,7 +82,7 @@ public class ChunkedOutputStreamHC4 exte
      * @param out       the output buffer to wrap
      * @throws IOException not thrown
      *
-     * @deprecated (4.3) use {@link ChunkedOutputStreamHC4#ChunkedOutputStream(int, SessionOutputBuffer)}
+     * @deprecated (4.3) use {@link ChunkedOutputStreamHC4#ChunkedOutputStreamHC4(int, SessionOutputBuffer)}
      */
     @Deprecated
     public ChunkedOutputStreamHC4(final SessionOutputBuffer out)



Mime
View raw message