Author: markt Date: Tue Apr 28 10:39:24 2009 New Revision: 769328 URL: http://svn.apache.org/viewvc?rev=769328&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46875 Catch possible ISE as a result of session expiration in comet valve
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=769328&r1=769327&r2=769328&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Apr 28 10:39:24 2009 @@ -104,12 +104,6 @@ +1: markt, remm -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46875 - http://svn.apache.org/viewvc?rev=758407&view=rev - Catch possible ISE as a result of session expiration in comet valve - +1: markt, rjung, remm - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46822 http://svn.apache.org/viewvc?rev=758616&view=rev Remove unnecessary object creation in StandardContext Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java?rev=769328&r1=769327&r2=769328&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java Tue Apr 28 10:39:24 2009 @@ -312,8 +312,14 @@ HttpSession session = request.getSession(false); if (session != null) { synchronized (session) { - Request[] reqs = (Request[]) - session.getAttribute(cometRequestsAttribute); + Request[] reqs = null; + try { + reqs = (Request[]) + session.getAttribute(cometRequestsAttribute); + } catch (IllegalStateException ise) { + // Ignore - session has been invalidated + // Listener will have cleaned up + } if (reqs != null) { boolean found = false; for (int i = 0; !found && (i < reqs.length); i++) { @@ -329,11 +335,22 @@ newConnectionInfos[pos++] = reqs[i]; } } - session.setAttribute(cometRequestsAttribute, - newConnectionInfos); + try { + session.setAttribute( + cometRequestsAttribute, + newConnectionInfos); + } catch (IllegalStateException ise) { + // Ignore - session has been invalidated + // Listener will have cleaned up + } } else { - session.removeAttribute( - cometRequestsAttribute); + try { + session.removeAttribute( + cometRequestsAttribute); + } catch (IllegalStateException ise) { + // Ignore - session has been invalidated + // Listener will have cleaned up + } } } } Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=769328&r1=769327&r2=769328&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Apr 28 10:39:24 2009 @@ -45,6 +45,10 @@ <fix> <bug>46866</bug>: Better initialisation of Random objects. (markt) </fix> + <fix> + <bug>46875</bug>: Catch and handle possible IllegalStateExceptions + in CometConnectionManagerValve related to session expiration. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org