Author: markt
Date: Wed Mar 25 18:57:43 2009
New Revision: 758407
URL: http://svn.apache.org/viewvc?rev=758407&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46875
Add try/catch to session access in case session has been invalidated
Modified:
tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
Modified:
tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java?rev=758407&r1=758406&r2=758407&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
Wed Mar 25 18:57:43 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
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]