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 2011/12/18 14:48:12 UTC

svn commit: r1220405 - in /httpcomponents/httpcore/branches/4.1.x: RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java

Author: olegk
Date: Sun Dec 18 13:48:12 2011
New Revision: 1220405

URL: http://svn.apache.org/viewvc?rev=1220405&view=rev
Log:
HTTPCORE-286: Canceled I/O session can cause an IllegalStateException in BaseIOReactor#validate leading to an abnormal termination of the I/O reactor

Modified:
    httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt
    httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java

Modified: httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt?rev=1220405&r1=1220404&r2=1220405&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt Sun Dec 18 13:48:12 2011
@@ -1,13 +1,17 @@
 Changes since 4.1.3
 -------------------
 
+* [HTTPCORE-286] Canceled I/O session can cause an IllegalStateException in BaseIOReactor#validate
+  leading to an abnormal termination of the I/O reactor.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCORE-257] Fixed incorrect results produced by DefaultConnectionReuseStrategy when handling 
   response messages whose content entity has been decoded or modified by a protocol interceptor. 
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 
 * [HTTPCORE-283] Workaround for a bug causing termination of the I/O reactor in case of exception 
   thrown by NHttpServiceHandler#requestReceived or NHttpClientHandler#responseReceived
-  methods. A more comprehensive fix for the bug applied to the (4.2 branch).
+  methods. A more comprehensive fix for the bug applied to the 4.2 branch.
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 
 * [HTTPCORE-281] ResponseConnControl protocol interceptor does not correctly populate connection

Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java?rev=1220405&r1=1220404&r2=1220405&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java (original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java Sun Dec 18 13:48:12 2011
@@ -213,28 +213,18 @@ public class BaseIOReactor extends Abstr
                     it.remove();
                     continue;
                 }
-
-                int ops = 0;
                 try {
-                    ops = session.getEventMask();
+                    if ((session.getEventMask() & EventMask.READ) > 0) {
+                        this.eventDispatch.inputReady(session);
+                        if (!session.hasBufferedInput()) {
+                            it.remove();
+                        }
+                    }
                 } catch (CancelledKeyException ex) {
                     it.remove();
                     queueClosedSession(session);
-                    continue;
-                }
-
-                if ((ops & EventMask.READ) > 0) {
-                    try {
-                        this.eventDispatch.inputReady(session);
-                    } catch (CancelledKeyException ex) {
-                        it.remove();
-                        queueClosedSession(session);
-                    } catch (RuntimeException ex) {
-                        handleRuntimeException(ex);
-                    }
-                    if (!session.hasBufferedInput()) {
-                        it.remove();
-                    }
+                } catch (RuntimeException ex) {
+                    handleRuntimeException(ex);
                 }
             }
         }