Return-Path: Delivered-To: apache-bugdb-archive@hyperreal.org Received: (qmail 7438 invoked by uid 6000); 19 Mar 1999 19:50:06 -0000 Received: (qmail 7330 invoked by uid 2001); 19 Mar 1999 19:50:03 -0000 Received: (qmail 6029 invoked by uid 2012); 19 Mar 1999 19:44:55 -0000 Message-Id: <19990319194455.6028.qmail@hyperreal.org> Date: 19 Mar 1999 19:44:55 -0000 From: Kok Kin Kee Reply-To: kkee@geoworks.com To: apbugs@hyperreal.org X-Send-Pr-Version: 3.2 Subject: mod_jserv/4092: session.invalidate() then req.getSession() returns invalidated session. Sender: apache-bugdb-owner@apache.org Precedence: bulk >Number: 4092 >Category: mod_jserv >Synopsis: session.invalidate() then req.getSession() returns invalidated session. >Confidential: no >Severity: serious >Priority: medium >Responsible: jserv >State: open >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Fri Mar 19 11:50:02 PST 1999 >Last-Modified: >Originator: kkee@geoworks.com >Organization: apache >Release: Apache 1.3.4, Apache JServ 1.0b1 >Environment: Win NT4.0, JDK 1.2, JSDK 2.0 >Description: HttpSession session = req.getSession(true); session.invalidate() // This statement returns the same invalidated session // as above! session = req.getSession(true); >How-To-Repeat: Here is the complete code: //--------------- import java.io.*; import java.lang.*; import javax.servlet.*; import javax.servlet.http.*; /** * * Get a session, invalidate it, and then get a new one. */ public class SessionTest extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); ServletOutputStream out = resp.getOutputStream(); HttpSession session = req.getSession(true); out.println("Current session Id: "); out.println(session.getId()); out.println("
"); // Testing invalidate... session.invalidate(); // Should get a new session after invalidate. session = req.getSession(true); // Try to use the session, if session is invalid, it will // throw an exception. However, this session should be valid! out.println("New session Id: "); try { out.println(session.getId()); } catch (Exception e) { out.println(e.getMessage()); } out.println("
"); } public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } } //------------- >Fix: >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, ] [you need to include in the Cc line ] [and leave the subject line UNCHANGED. This is not done] [automatically because of the potential for mail loops. ] [If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request ] [from a developer. ] [Reply only with text; DO NOT SEND ATTACHMENTS! ]