Bug 50318

Summary: NPE when opening Session Details page for an expired session
Product: Tomcat 7 Reporter: Konstantin Kolinko <knst.kolinko>
Component: ManagerAssignee: Tomcat Developers Mailing List <dev>
Severity: minor    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Konstantin Kolinko 2010-11-22 16:20:41 UTC
Running current trunk at r1037887

1. In default web.xml set <session-timeout> to some small value, e.g. 1 minute
2. Create a session, e.g. in the examples webapp.
3. Go to the manager webapp and display the list of sessions.
4. Do not close the page. Wait for several minutes, so that session expires.
5. Click on the session id, to open the Session Details page for the session.
6. Actual result: The page does not open, but the default page (the list of webapps) is shown, with a message about an NPE.
Expected result: I would be nice to display a blank Session Details page with a message and with the "Return to session list" button.

org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/sessionDetail.jsp at line 35

32:    String version = (String) request.getAttribute("version");
33:    ContextName cn = new ContextName(path, version);
34:    Session currentSession = (Session)request.getAttribute("currentSession");
35:    HttpSession currentHttpSession = currentSession.getSession();
36:    String currentSessionId = JspHelper.escapeXml(currentSession.getId());
37:    String submitUrl = JspHelper.escapeXml(response.encodeURL(
38:            ((HttpServletRequest) pageContext.getRequest()).getRequestURI() +

Line 35 is "currentSession.getSession()"

From logs:
Caused by: java.lang.NullPointerException
	at org.apache.jsp.WEB_002dINF.jsp.sessionDetail_jsp._jspService(sessionDetail_jsp.java:74)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
	... 33 more
Comment 1 Mark Thomas 2010-11-23 13:01:18 UTC
Fixed in 7.0.x and will be included in 7.0.5 onwards