Mantis - Resin
Viewing Issue Advanced Details
703 minor always 01-05-06 09:00 01-10-06 15:01
ferg  
 
urgent  
closed 3.0.17  
fixed  
none    
none 3.0.18  
0000703: IllegalStateException for getAttribute
(rep by Bryan Davis)

There are are other areas where resin (3.0.16) is throwing exception in PageContext.removeAttribute when the session is invalid. This is counter to the J2EE specification
( http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/JspContext.html#removeAttribute(java.lang.String) [^] ) which indicates that no such exception should be thrown.
 
Below is the jsp code that is throwing the exception, the generated java code from the jsp and the stack trace, as well as a patch to correct the problem
 
jsp code
 <c:forEach items="${stylesheetList}" var="s">
             <link rel="stylesheet" type="text/css" href="${s}" />
</c:forEach>
 
generated java code:
while (_jsp_iter_29.hasNext()) {
        Object _jsp_i_29 = _jsp_iter_29.next();
        pageContext.setAttribute("s", _jsp_i_29);
        _jsp_loop_4.setCurrent(_jsp_i_29, _jsp_iter_29.hasNext());
        out.write(_jsp_string6, 0, _jsp_string6.length);
        out.print(_caucho_expr_5.evalStringNonNull(pageContext));
        out.write(_jsp_string7, 0, _jsp_string7.length);
      }
      pageContext.pageSetOrRemove("s", _jsp_oldVar_29);
      out.write(_jsp_string8, 0, _jsp_string8.length);
      if (_jsp_UseAttributeTag_4 == null) {
        _jsp_UseAttributeTag_4 = new org.apache.struts.taglib.tiles.UseAttributeTag();
        _jsp_UseAttributeTag_4.setPageContext(pageContext);
        _jsp_UseAttributeTag_4.setParent((javax.servlet.jsp.tagext.Tag) null);
        _jsp_UseAttributeTag_4.setClassname("java.util.List");
        _jsp_UseAttributeTag_4.setIgnore(true);
      }
 
exception
java.lang.IllegalStateException: Can't call removeAttribute(String) when session is no longer valid.
at com.caucho.server.session.SessionImpl.removeAttribute(SessionImpl.java:359)
at com.caucho.jsp.PageContextImpl.removeAttribute(PageContextImpl.java:322)
at com.caucho.jsp.PageContextImpl.pageSetOrRemove(PageContextImpl.java:1500)
at _jsp._WEB_22dINF._jsp._tiles._layout._brand._newauction__jspx._jspService(_newauction__jspx.java:131)
at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
at com.caucho.jsp.Page.pageservice(Page.java:570)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:159)
at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:268)
at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106)
at com.foo.ui.brand.BrandManager.tilePage(BrandManager.java:629)
at com.foo.framework.servlet.BaseServlet.processTilesDefinition(BaseServlet.java:404)
at com.foo.framework.servlet.BaseServlet.displayPage(BaseServlet.java:325)
at com.foo.framework.servlet.BaseServlet.handleAction(BaseServlet.java:208)
at com.foo.framework.servlet.BaseServlet.service(BaseServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at com.foo.hibernate.HibernateFilter.doFilter(HibernateFilter.java:55)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.foo.servlet.filter.PrincipalFilter.doFilter(PrincipalFilter.java:44)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.foo.servlet.filter.AdrefCookieFilter.doFilter(AdrefCookieFilter.java:117)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.foo.servlet.filter.TrackingFilter.doFilter(TrackingFilter.java:190)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.foo.servlet.filter.UrlTranslateFilter.doFilter(UrlTranslateFilter.java:129)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:209)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:419)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:388)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
at java.lang.Thread.run(Thread.java:595)
 
 
 
patch:
 
 
-- PageContextImpl.java 2006-01-04 16:06:43.000000000 -0600
+++ PageContextImpl.java.orig 2006-01-04 16:06:09.000000000 -0600
@@ -318,11 +318,8 @@
     // jsp/162b
     if (_request != null)
       _request.removeAttribute(name);
- try
- {
- if (_session != null)
- _session.removeAttribute(name);
- } catch (IllegalStateException iex) {}
+ if (_session != null)
+ _session.removeAttribute(name);
     if (_application != null)
       _application.removeAttribute(name);
   }

Notes
(0000665)
ferg   
01-10-06 15:01   
jsp/162f