hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1559340 - /httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Date Sat, 18 Jan 2014 11:42:54 GMT
Author: olegk
Date: Sat Jan 18 11:42:53 2014
New Revision: 1559340

URL: http://svn.apache.org/r1559340
Log:
HTTPCLIENT-1448: Add context information to NoHttpResponseException

Modified:
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=1559340&r1=1559339&r2=1559340&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Sat Jan 18 11:42:53 2014
@@ -42,6 +42,7 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
+import org.apache.http.NoHttpResponseException;
 import org.apache.http.ProtocolException;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.annotation.NotThreadSafe;
@@ -654,12 +655,14 @@ public class DefaultRequestDirector impl
                 if (retryHandler.retryRequest(ex, connectCount, context)) {
                     if (this.log.isInfoEnabled()) {
                         this.log.info("I/O exception ("+ ex.getClass().getName() +
-                                ") caught when connecting to the target host: "
+                                ") caught when connecting to "
+                                + route +
+                                ": "
                                 + ex.getMessage());
                         if (this.log.isDebugEnabled()) {
                             this.log.debug(ex.getMessage(), ex);
                         }
-                        this.log.info("Retrying connect");
+                        this.log.info("Retrying connect to " + route);
                     }
                 } else {
                     throw ex;
@@ -724,16 +727,27 @@ public class DefaultRequestDirector impl
                 if (retryHandler.retryRequest(ex, wrapper.getExecCount(), context)) {
                     if (this.log.isInfoEnabled()) {
                         this.log.info("I/O exception ("+ ex.getClass().getName() +
-                                ") caught when processing request: "
+                                ") caught when processing request to "
+                                + route +
+                                ": "
                                 + ex.getMessage());
                     }
                     if (this.log.isDebugEnabled()) {
                         this.log.debug(ex.getMessage(), ex);
                     }
-                    this.log.info("Retrying request");
+                    if (this.log.isInfoEnabled()) {
+                        this.log.info("Retrying request to " + route);
+                    }
                     retryReason = ex;
                 } else {
-                    throw ex;
+                    if (ex instanceof NoHttpResponseException) {
+                        final NoHttpResponseException updatedex = new NoHttpResponseException(
+                                route.getTargetHost().toHostString() + " failed to respond");
+                        updatedex.setStackTrace(ex.getStackTrace());
+                        throw updatedex;
+                    } else {
+                        throw ex;
+                    }
                 }
             }
         }



Mime
View raw message