Bug 45195 - Possible regression issue with HttpSession.getAtttribute()
Summary: Possible regression issue with HttpSession.getAtttribute()
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Unknown (show other bugs)
Version: 5.5.26
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-12 11:59 UTC by Jonathan
Modified: 2008-08-14 02:11 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan 2008-06-12 11:59:07 UTC
We just upgraded from Tomcat 5.0.x to 5.5.26.  In Tomcat 5.0.x, the following code returned NULL to obj:

HttpSession session = request.getSession(true);
Object obj = session.getAttribute(null);

In Tomcat 5.5.26, that same code raises this exception:

java.lang.NullPointerException
java.util.Hashtable.get(Unknown Source)
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1024) org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110) NewServlet.processRequest(NewServlet.java:29) NewServlet.doGet(NewServlet.java:52) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I know how to code around it, but doesn't this qualify as a bug, at least for regression purposes?

FYI: I'm using JDK 5.
Comment 1 Mark Thomas 2008-06-12 15:07:42 UTC
The spec is non-specific in this case.

You could argue this either way but the fix should be trivial. I'll take a look.
Comment 2 Mark Thomas 2008-06-13 12:26:48 UTC
This has been fixed in trunk and proposed for 6.0.x and 5.5.x

Thanks for the report.
Comment 3 Mark Thomas 2008-06-26 13:17:41 UTC
This has been fixed in 6.0.x and will be included in 6.0.17 onwards.
Comment 4 Mark Thomas 2008-08-14 02:11:54 UTC
This has been fixed in 5.5.x and will be included in 5.5.27 onwards.