Bug 64965 - IllegalStateException is thrown in JspContextWrapper.findAttribute()
Summary: IllegalStateException is thrown in JspContextWrapper.findAttribute()
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 9.0.40
Hardware: All All
: P2 minor (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2020-12-08 15:03 UTC by Andreas Bergander
Modified: 2020-12-08 15:35 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Bergander 2020-12-08 15:03:59 UTC
We get an IllegalStateException from JspContextWrapper.findAttribute() in our logs every now and then due to the session being invalid while resolving EL variables.

In PageContextImpl.findAttribute() this exception is caught. But the exception is not caught in JspContextWrapper.findAttribute(). Shouldn't the same error handling be applied to JspContextWrapper? And according to the javadoc in JspContext the findAttribute method should not throw IllegalStateException. Or is there a reason for not catching that exception?

In PageContextImpl.findAttribute():

try {
	o = session.getAttribute(name);
} catch(IllegalStateException ise) {
	// Session has been invalidated.
	// Ignore and fall through to application scope.

In JspContextWrapper.findAttribute():

if (getSession() != null) {
	o = rootJspCtxt.getAttribute(name, SESSION_SCOPE);
Comment 1 Remy Maucherat 2020-12-08 15:20:27 UTC
I read all the javadoc and verified and I agree with this.
Comment 2 Remy Maucherat 2020-12-08 15:35:28 UTC
This will be fixed in Tomcat 10.0.1, 9.0.42, 8.5.62 and 7.0.108. Thanks.