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/10/03 00:56:02 UTC

DefaultCookieParser NullPointerException Patch

Back on January 18, 2002 a patch was submitted by Stephane Bailliez to fix a
NullPointerException in DefaultCookieParser.
DefaultCookieParser should be expecting a null since HttpServletRequest
returns null if no cookies were sent to the server.

Any chance this fix can be applied to repository?

I've pasted the original patch below.  Of course, it's now out of date but
it gets the point across.

Thanks,
  David



Index: DefaultCookieParser.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/util/parser/De
faultCookieParser.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 DefaultCookieParser.java
--- DefaultCookieParser.java	16 Aug 2001 05:09:58 -0000	1.1.1.1
+++ DefaultCookieParser.java	18 Jan 2002 12:19:42 -0000
@@ -152,16 +152,18 @@
         cookiePath = new DynamicURI(data);
 
         Cookie[] cookies = data.getRequest().getCookies();
-
-        Log.info ("Number of Cookies "+cookies.length);
-
-        for (int i=0; i<cookies.length; i++)
+        int cookiesCount = (cookies != null ? cookies.length : 0);
+        
+        Log.info ("Number of Cookies: " + cookiesCount);
+        
+        for (int i = 0; i < cookiesCount; i++)
         {
             String name = convert (cookies[i].getName());
             String value = cookies[i].getValue();
-            Log.info ("Adding "+name+"="+value);
+            Log.info ("Adding " + name + "=" + value);
             add (name,value);
         }
+
 
         this.data = data;
     }




*********************************************************************
This e-mail and any attachment is confidential. It may only be read, copied and used by the intended recipient(s). If you are not the intended recipient(s), you may not copy, use, distribute, forward, store or disclose this e-mail or any attachment. If you are not the intended recipient(s) or have otherwise received this e-mail in error, you should destroy it and any attachment and notify the sender by reply e-mail or send a message to sysadmin@bluearc.com
*********************************************************************


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


Re: DefaultCookieParser NullPointerException Patch

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Henning P. Schmiedehausen" <hp...@intermeta.de> writes:

> David Vandegrift <dv...@bluearc.com> writes:
> 
> >Back on January 18, 2002 a patch was submitted by Stephane Bailliez to fix a
> >NullPointerException in DefaultCookieParser.
> >DefaultCookieParser should be expecting a null since HttpServletRequest
> >returns null if no cookies were sent to the server.
> 
> This also applies to Fulcrum. Good spotting. Thanks.

Has this been checked in?
-- 

Daniel Rall <dl...@finemaltcoding.com>

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


Re: DefaultCookieParser NullPointerException Patch

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
David Vandegrift <dv...@bluearc.com> writes:

>Back on January 18, 2002 a patch was submitted by Stephane Bailliez to fix a
>NullPointerException in DefaultCookieParser.
>DefaultCookieParser should be expecting a null since HttpServletRequest
>returns null if no cookies were sent to the server.

This also applies to Fulcrum. Good spotting. Thanks.

	Ciao
		Henning
-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

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


Re: DefaultCookieParser NullPointerException Patch

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Yo T2 developers -- this one make it in?

David Vandegrift <dv...@bluearc.com> writes:

> Back on January 18, 2002 a patch was submitted by Stephane Bailliez to fix a
> NullPointerException in DefaultCookieParser.
> DefaultCookieParser should be expecting a null since HttpServletRequest
> returns null if no cookies were sent to the server.
> 
> Any chance this fix can be applied to repository?
> 
> I've pasted the original patch below.  Of course, it's now out of date but
> it gets the point across.
> 
> Thanks,
>   David
> 
> 
> 
> Index: DefaultCookieParser.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/util/parser/De
> faultCookieParser.java,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 DefaultCookieParser.java
> --- DefaultCookieParser.java	16 Aug 2001 05:09:58 -0000	1.1.1.1
> +++ DefaultCookieParser.java	18 Jan 2002 12:19:42 -0000
> @@ -152,16 +152,18 @@
>          cookiePath = new DynamicURI(data);
>  
>          Cookie[] cookies = data.getRequest().getCookies();
> -
> -        Log.info ("Number of Cookies "+cookies.length);
> -
> -        for (int i=0; i<cookies.length; i++)
> +        int cookiesCount = (cookies != null ? cookies.length : 0);
> +        
> +        Log.info ("Number of Cookies: " + cookiesCount);
> +        
> +        for (int i = 0; i < cookiesCount; i++)
>          {
>              String name = convert (cookies[i].getName());
>              String value = cookies[i].getValue();
> -            Log.info ("Adding "+name+"="+value);
> +            Log.info ("Adding " + name + "=" + value);
>              add (name,value);
>          }
> +
>  
>          this.data = data;
>      }
-- 

Daniel Rall <dl...@finemaltcoding.com>

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