hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1630023 - /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
Date Wed, 08 Oct 2014 07:36:17 GMT
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(



Mime
View raw message