Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=37929 by restoring r357410...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 16 Apr 2009 15:16:43 +0000 (15:16 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 16 Apr 2009 15:16:43 +0000 (15:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@765662 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/runtime/PageContextImpl.java

index 5a9d03d..3b47494 100644 (file)
@@ -423,8 +423,13 @@ public class PageContextImpl extends PageContext {
                        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)
@@ -467,7 +472,12 @@ public class PageContextImpl extends PageContext {
                        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;
                }
@@ -531,17 +541,17 @@ public class PageContextImpl extends PageContext {
        }
 
        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() {