Author: remy.maucherat(a)jboss.com
Date: 2009-03-23 06:50:08 -0400 (Mon, 23 Mar 2009)
New Revision: 969
Modified:
branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java
branches/2.1.x/webapps/docs/changelog.xml
Log:
- 46875: fix possible ISE on session access.
- Also use the regular close so that it goes in a container thread later, directly calling
webapp code is evil.
Modified: branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java
===================================================================
---
branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-23
10:48:50 UTC (rev 968)
+++
branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-23
10:50:08 UTC (rev 969)
@@ -35,13 +35,11 @@
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.connector.HttpEventImpl;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
import org.jboss.servlet.http.HttpEvent;
-import org.jboss.servlet.http.HttpEventServlet;
/**
@@ -201,14 +199,15 @@
// serializable or required.
HttpSession session = request.getSession(false);
if (session != null) {
- session.removeAttribute(cometRequestsAttribute);
+ try {
+ session.removeAttribute(cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
}
// Close the comet connection
try {
- HttpEventImpl cometEvent = request.getEvent();
- cometEvent.setType(HttpEvent.EventType.END);
- getNext().event(request, request.getResponse(), cometEvent);
- cometEvent.close();
+ request.getEvent().close();
} catch (Exception e) {
container.getLogger().warn(
sm.getString("cometConnectionManagerValve.event"),
@@ -328,8 +327,12 @@
session.setAttribute(cometRequestsAttribute,
newConnectionInfos);
} else {
- session.removeAttribute(
- cometRequestsAttribute);
+ try {
+ session.removeAttribute(
+ cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
}
}
}
@@ -353,10 +356,7 @@
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
- HttpEventImpl event = req.getEvent();
- event.setType(HttpEvent.EventType.END);
- ((HttpEventServlet) req.getWrapper().getServlet()).event(event);
- event.close();
+ req.getEvent().close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger().warn(sm.getString(
"cometConnectionManagerValve.listenerEvent"), e);
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-03-23 10:48:50 UTC (rev 968)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-03-23 10:50:08 UTC (rev 969)
@@ -26,6 +26,9 @@
<fix>
NPE in various realms. (markt)
</fix>
+ <fix>
+ <bug>46875</bug>: ISE on session access in Comet valve. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
Show replies by date