Author: remy.maucherat(a)jboss.com
Date: 2009-04-16 12:11:07 -0400 (Thu, 16 Apr 2009)
New Revision: 1009
Modified:
trunk/java/org/apache/jasper/runtime/PageContextImpl.java
trunk/webapps/docs/changelog.xml
Log:
- Port patch.
Modified: trunk/java/org/apache/jasper/runtime/PageContextImpl.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/PageContextImpl.java 2009-04-15 10:15:38 UTC (rev
1008)
+++ trunk/java/org/apache/jasper/runtime/PageContextImpl.java 2009-04-16 16:11:07 UTC (rev
1009)
@@ -421,8 +421,13 @@
return REQUEST_SCOPE;
if (session != null) {
- if (session.getAttribute(name) != null)
- return SESSION_SCOPE;
+ try {
+ if (session.getAttribute(name) != null)
+ return SESSION_SCOPE;
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall through to application scope.
+ }
}
if (context.getAttribute(name) != null)
@@ -464,7 +469,12 @@
return o;
if (session != null) {
- o = session.getAttribute(name);
+ try {
+ o = session.getAttribute(name);
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall through to application scope.
+ }
if (o != null)
return o;
}
@@ -528,17 +538,17 @@
}
private void doRemoveAttribute(String name) {
- try {
- removeAttribute(name, PAGE_SCOPE);
- removeAttribute(name, REQUEST_SCOPE);
- if (session != null) {
- removeAttribute(name, SESSION_SCOPE);
- }
- removeAttribute(name, APPLICATION_SCOPE);
- } catch (Exception ex) {
- // we remove as much as we can, and
- // simply ignore possible exceptions
- }
+ removeAttribute(name, PAGE_SCOPE);
+ removeAttribute(name, REQUEST_SCOPE);
+ if( session != null ) {
+ try {
+ removeAttribute(name, SESSION_SCOPE);
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall throw to application scope.
+ }
+ }
+ removeAttribute(name, APPLICATION_SCOPE);
}
public JspWriter getOut() {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-04-15 10:15:38 UTC (rev 1008)
+++ trunk/webapps/docs/changelog.xml 2009-04-16 16:11:07 UTC (rev 1009)
@@ -95,6 +95,9 @@
<bug>42390</bug>: Correct JSP compilation error with nested tagfile
tags with variables with "AT_BEGIN" scope.
Patch provided by Konstantin Kolinko. (markt)
</fix>
+ <fix>
+ <bug>37929</bug>: Fix session access to an invalidated session.
(markt)
+ </fix>
</changelog>
</subsection>
</section>
Show replies by date