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 2014/10/08 09:36:17 UTC

svn commit: r1630023 - /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java

Author: olegk
Date: Wed Oct  8 07:36:16 2014
New Revision: 1630023

URL: http://svn.apache.org/r1630023
Log:
Create PipelineEntry with exception object on exception in request handler
Contributed by Dmitry Potapov <dpotapov at yandex-team.ru>

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java?rev=1630023&r1=1630022&r2=1630023&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java Wed Oct  8 07:36:16 2014
@@ -443,7 +443,21 @@ public class HttpAsyncService implements
                             request, response, state, conn, context);
                     final HttpAsyncRequestHandler<Object> handler = pipelineEntry.getHandler();
                     conn.suspendOutput();
-                    handler.handle(result, httpExchange, context);
+                    try {
+                        handler.handle(result, httpExchange, context);
+                    } catch (RuntimeException ex) {
+                        throw ex;
+                    } catch (Exception ex) {
+                        pipeline.add(new PipelineEntry(
+                            request,
+                            null,
+                            ex,
+                            handler,
+                            context));
+                        state.setResponseState(MessageState.READY);
+                        responseReady(conn);
+                        return;
+                    }
                 } else {
                     final Exception exception = pipelineEntry.getException();
                     final HttpAsyncResponseProducer responseProducer = handleException(