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:44:20 UTC

svn commit: r1220402 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java

Author: olegk
Date: Sun Dec 18 13:44:20 2011
New Revision: 1220402

URL: http://svn.apache.org/viewvc?rev=1220402&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/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=1220402&r1=1220401&r2=1220402&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Sun Dec 18 13:44:20 2011
@@ -1,6 +1,10 @@
 Changes since Release 4.2-ALPHA2
 -------------------
 
+* [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-281] ResponseConnControl protocol interceptor does not correctly populate connection
   persistence control headers when sending a HTTP/1.1 response message in response to a HTTP/1.0 
   request message.

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java?rev=1220402&r1=1220401&r2=1220402&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java Sun Dec 18 13:44:20 2011
@@ -215,28 +215,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);
                 }
             }
         }