Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 79089 invoked from network); 19 Nov 2008 22:27:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Nov 2008 22:27:01 -0000 Received: (qmail 60833 invoked by uid 500); 19 Nov 2008 22:27:05 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 60788 invoked by uid 500); 19 Nov 2008 22:27:05 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 60777 invoked by uid 99); 19 Nov 2008 22:27:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Nov 2008 14:27:05 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Nov 2008 22:25:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 81CF42388999; Wed, 19 Nov 2008 14:26:06 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r719096 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Date: Wed, 19 Nov 2008 22:26:06 -0000 To: dev@tomcat.apache.org From: fhanik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081119222606.81CF42388999@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fhanik Date: Wed Nov 19 14:26:06 2008 New Revision: 719096 URL: http://svn.apache.org/viewvc?rev=719096&view=rev Log: fix NPE risk Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=719096&r1=719095&r2=719096&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Nov 19 14:26:06 2008 @@ -1429,7 +1429,8 @@ processSocket(ka.getChannel(), status, false); //don't dispatch if the lines below are cancelling the key } } - handler.release(ka.getChannel()); + + if (ka!=null) handler.release(ka.getChannel()); if (key.isValid()) key.cancel(); if (key.channel().isOpen()) try {key.channel().close();}catch (Exception ignore){} try {ka.channel.close(true);}catch (Exception ignore){} @@ -1610,13 +1611,26 @@ sd.length -= written; } if ( sd.length <= 0 ) { + if (log.isDebugEnabled()) { + log.debug("Send file complete for:"+sd.fileName); + } attachment.setSendfileData(null); if ( sd.keepAlive ) { + if (log.isDebugEnabled()) { + log.debug("Connection is keep alive, registering back for OP_READ"); + } if (reg) reg(sk,attachment,SelectionKey.OP_READ); } else { + if (log.isDebugEnabled()) { + log.debug("Send file connection is being closed"); + } cancelledKey(sk,SocketStatus.STOP,false); } } else if ( attachment.interestOps() == 0 && reg ) { + if (log.isDebugEnabled()) { + log.debug("OP_WRITE for sendilfe:"+sd.fileName); + } + reg(sk,attachment,SelectionKey.OP_WRITE); } }catch ( IOException x ) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org