tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/session
Date Mon, 26 Mar 2001 14:47:59 GMT
melaquias    01/03/26 06:47:58

  Modified:    src/share/org/apache/tomcat/modules/session
  Temporary(?) fix to stop crashes when creating a new Session in embedded use of Jasper (i.e.
as standalone JspServlet ).  Problem may occur in other situations as well, I'm not sure.
  Problem:  When SimpleSessionStore.SimpleSessionManager.getNewSession() is called (as a result
of a call to request.getSession(), the session ID of the new session has not been set.  Since
it is implemented as a MessageBytes object, the .toString() method to get a string representation
of the session id returns null.  When getNewSession() tries to use this value as a key into
the sessions hashtable, a NullPointerException is thrown.
  Fix:  To stop the crashing, I've added a line to "getNewSession()" to replace a null value
for the string representation with the literal "null".  This should NOTbe considered a fix
of the underlying problem:  Why is newId == null (i.e. why is the new session's id not initialized)?
 The implication is that request.getSession() is broken in jasper right now, at least when
using Jasper independent of tomcat.
  Revision  Changes    Path
  1.15      +5 -1      jakarta-tomcat/src/share/org/apache/tomcat/modules/session/
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/session/,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  ---	2001/03/23 02:24:36	1.14
  +++	2001/03/26 14:47:58	1.15
  @@ -337,6 +337,11 @@
   	    // The id will be set by one of the modules
   	    String newId=session.getId().toString();
  +//XXXXX - the following is a temporary fix only!  Underlying problem
  +//        is:  Why is the newId==null?
  +	    newId=(newId==null)?"null":newId;
   	    // What if the newId belongs to an existing session ?
   	    // This shouldn't happen ( maybe we can try again ? )
   	    ServerSession oldS=findSession( newId );
  @@ -344,7 +349,6 @@
   		// that's what the original code did
   		oldS.setState( ServerSession.STATE_EXPIRED );
   	    sessions.put( newId, session );
   	    return (session);

View raw message