You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hunter Hillegas <li...@lastonepicked.com> on 2001/09/25 20:52:16 UTC

Tomcat 4.0 Bug Status

Anyone know the status of this bug:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3799

Basically, setting a cookie with a null value throws an exception... This
causes many webapps like Jive Forums to just not work...

Hunter


Re: Tomcat 4.0 Bug Status

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Tue, 25 Sep 2001, Hunter Hillegas wrote:

> Date: Tue, 25 Sep 2001 11:52:16 -0700
> From: Hunter Hillegas <li...@lastonepicked.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: Tomcat User List <to...@jakarta.apache.org>
> Subject: Tomcat 4.0 Bug Status
>
> Anyone know the status of this bug:
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3799
>
> Basically, setting a cookie with a null value throws an exception... This
> causes many webapps like Jive Forums to just not work...
>
> Hunter
>
>

Unfortunately, the bug report is incorrect, and applications that rely on
the proposed behavior are broken.

The proper way to delete a cookie is to set the maximum age to zero before
sending the cookie:

  Cookie cookie = new Cookie("foo", "arbitrary value");
  cookie.setMaxAge(0);
  response.addCookie(cookie);

See the Javadocs for javax.servlet.http.Cookie.setMaxAge() for details.

Even if setting the value to null did not cause an NPE, it would not
delete your cookie.


Craig