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 2004/06/04 11:54:48 UTC

DO NOT REPLY [Bug 29387] New: - Null pointer exception in CoyoteRequest in parseCookies() method when cookie name is reserved word

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=29387

Null pointer exception in CoyoteRequest in parseCookies() method when cookie name is reserved word

           Summary: Null pointer exception in CoyoteRequest in
                    parseCookies() method when cookie name is reserved word
           Product: Tomcat 5
           Version: 5.0.25
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: flopitaux@instranet.com


The problem arrives when Tomcat receive an HTTP request with one of the cookie
have reserved name like "Path".

So because one of the cookie name is reserved name, it's throw
IllegalArgumentException but the problem is that log object is null.

i guest that you was wanted to write just log method and not log.info.

CoyoteRequest.java from line 2330 :
for (int i = 0; i < count; i++) {
            ServerCookie scookie = serverCookies.getCookie(i);
            System.out.println("scookie="+scookie);
            try {
                Cookie cookie = new Cookie(scookie.getName().toString(),
                                           scookie.getValue().toString());
                cookie.setPath(scookie.getPath().toString());
                cookie.setVersion(scookie.getVersion());
                String domain = scookie.getDomain().toString();
                if (domain != null) {
                    cookie.setDomain(scookie.getDomain().toString());
                }
                cookies[idx++] = cookie;
            } catch(IllegalArgumentException e) {
                log.info("Bad Cookie: Name: " + scookie.getName() 
                         + " Value: " + scookie.getValue());
            }

Exception throws : 
java.lang.NullPointerException
        at
org.apache.coyote.tomcat5.CoyoteRequest.parseCookies(CoyoteRequest.java:2343)
        at
org.apache.coyote.tomcat5.CoyoteRequest.getCookies(CoyoteRequest.java:1850)
        at
org.apache.coyote.tomcat5.CoyoteRequestFacade.getCookies(CoyoteRequestFacade.java:418)

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org