Author: markt
Date: Tue Mar 20 11:10:46 2012
New Revision: 1302839

URL: http://svn.apache.org/viewvc?rev=1302839&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52926
Protect against a NPE if the socket has been closed on another thread

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1302837

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1302839&r1=1302838&r2=1302839&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue 
Mar 20 11:10:46 2012
@@ -718,6 +718,9 @@ public class NioEndpoint extends Abstrac
     public boolean processSocket(NioChannel socket, SocketStatus status, 
boolean dispatch) {
         try {
             KeyAttachment attachment = 
(KeyAttachment)socket.getAttachment(false);
+            if (attachment == null) {
+                return false;
+            }
             attachment.setCometNotify(false); //will get reset upon next reg
             SocketProcessor sc = processorCache.poll();
             if ( sc == null ) sc = new SocketProcessor(socket,status);

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1302839&r1=1302838&r2=1302839&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Mar 20 11:10:46 2012
@@ -137,6 +137,10 @@
         client breaks the connection before reading all the requested data.
         (markt)
       </fix>
+      <fix>
+        <bug>52926</bug>: Avoid NPE when an NIO Comet connection times out on
+        one thread at the same time as it is closed on another thread. (markt) 
 
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to