You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2001/09/25 00:09:00 UTC

DO NOT REPLY [Bug 3799] New: - Setting null cookie value throws exception

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3799>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

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

Setting null cookie value throws exception

           Summary: Setting null cookie value throws exception
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: bill@jivesoftware.com


The standard way to delete a cookie is to set the cookie's value to null then 
re-add the cookie to the response:

<%
    // Cookie test
    Cookie cookie = new Cookie("foo",null);
    // add cookie
    response.addCookie(cookie);
%>

This results in a NullPointerException because Tomcat tries to URLEncode a null 
value. The ability to delete a cookie is a critical necessity as it will 
prevent most webapps that use cookies from working correctly.