From e339971e05de5e6fae56fd89b352ae6efe025040 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 16 Apr 2009 15:16:43 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=37929 by restoring r357410 that was lost in r379417 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@765662 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/jasper/runtime/PageContextImpl.java | 38 ++++++++++++++-------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java b/java/org/apache/jasper/runtime/PageContextImpl.java index 5a9d03d2f..3b47494f9 100644 --- a/java/org/apache/jasper/runtime/PageContextImpl.java +++ b/java/org/apache/jasper/runtime/PageContextImpl.java @@ -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() { -- 2.11.0