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 2017/08/18 08:49:04 UTC

[2/2] httpcomponents-core git commit: Add a meaning full exception message when a timeout occurs.

Add a meaning full exception message when a timeout occurs.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/01402bb4
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/01402bb4
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/01402bb4

Branch: refs/heads/4.4.x
Commit: 01402bb4cefc3a1b983e6a64a6060d2944aa0979
Parents: cfd42ea
Author: Gary Gregory <ga...@gmail.com>
Authored: Thu Aug 17 15:28:32 2017 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri Aug 18 10:37:40 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java    | 3 ++-
 .../main/java/org/apache/http/nio/protocol/HttpAsyncService.java  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/01402bb4/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
index d4f84d1..3ef4e7d 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
@@ -375,7 +375,8 @@ public class HttpAsyncRequestExecutor implements NHttpClientEventHandler {
             state.invalidate();
             final HttpAsyncClientExchangeHandler handler = getHandler(conn);
             if (handler != null) {
-                handler.failed(new SocketTimeoutException());
+                handler.failed(new SocketTimeoutException(
+                        String.format("%,d milliseconds timeout on connection %s", conn.getSocketTimeout(), conn)));
                 handler.close();
             }
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/01402bb4/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
index 11f02aa..c9a461d 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
@@ -530,7 +530,8 @@ public class HttpAsyncService implements NHttpServerEventHandler {
     public void timeout(final NHttpServerConnection conn) throws IOException {
         final State state = getState(conn);
         if (state != null) {
-            exception(conn, new SocketTimeoutException());
+            exception(conn, new SocketTimeoutException(
+                    String.format("%,d milliseconds timeout on connection %s", conn.getSocketTimeout(), conn)));
         }
         if (conn.getStatus() == NHttpConnection.ACTIVE) {
             conn.close();