You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by David Vandegrift <dv...@bluearc.com> on 2002/11/01 23:05:59 UTC

[SOURCE] Issue #TTWS11 - DefaultCookieParser throws NullPointerException

You can view the issue detail at the following URL:
<http://nagoya.apache.org/scarab/issues/id/TTWS11>

Type :        Defect
Issue Id :    TTWS11
Reported by: David Vandegrift
             dvandegrift@bluearc.com - (dvandegrift@bluearc.com)

Details:

Platform: PC
Operating system: windows NT
Summary: DefaultCookieParser throws NullPointerException
Description: setRunData() in DefaultCookieParser.java will throw a NullPointerException if the HttpRequest does not yet have any cookies associated with it.
According to the Servlet Spec, HttpServletRequest.getCookies() retuns null if no cookies are defined.
Cookie[] cookies = data.getRequest().getCookies();

The existing code immediately accesses cookies.length. But since cookies is null an NPE is throw.
A patch is attached that adds a variable 'cookiesLength' and sets it's value by checking for null first.

Also, the patch removes a the redundant line:
cookiePath = new DynamicURI(data);


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>