Fix NPE
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Nov 2008 11:32:02 +0000 (11:32 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Nov 2008 11:32:02 +0000 (11:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@720173 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/http11/Http11NioProcessor.java

index 425d8c4..818b594 100644 (file)
@@ -1208,6 +1208,7 @@ public class Http11NioProcessor implements ActionHook {
         } else if (actionCode == ActionCode.ACTION_COMET_END) {
             comet = false;
         }  else if (actionCode == ActionCode.ACTION_COMET_CLOSE) {
+            if (socket==null || socket.getAttachment(false)==null) return;
             NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
             attach.setCometOps(NioEndpoint.OP_CALLBACK);
             //notify poller if not on a tomcat thread
@@ -1216,6 +1217,7 @@ public class Http11NioProcessor implements ActionHook {
                 socket.getPoller().cometInterest(socket);
         } else if (actionCode == ActionCode.ACTION_COMET_SETTIMEOUT) {
             if (param==null) return;
+            if (socket==null || socket.getAttachment(false)==null) return;
             NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
             long timeout = ((Long)param).longValue();
             //if we are not piggy backing on a worker thread, set the timeout