thank you.  That worked.
-paul lomack

----- Original Message ----- 
From: "Bodycombe, Andrew" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Tuesday, August 12, 2003 12:14 PM
Subject: RE: cookie problem


> The request.getCookies() will return null if no cookies were sent with the
> request.
> You should check that cookies != null before checking cookies.length
>
> -----Original Message-----
> From: Paul [mailto:[EMAIL PROTECTED]
> Sent: 12 August 2003 17:13
> To: Tomcat Users List
> Subject: cookie problem
>
>
> I hava a JSP application under Tomcat 4.1.24, jdk 1.4, running as service
on
> win2k currently in standalone mode.
> The default index.jsp page checks for cookie that has not yet been set.
> Under Tomcat 3.x (jdk 1.2), this cookie checking does not generate an
error;
> however, under Tomcat 4 it generates an HTTP Status 500 exception report,
> where the root cause is given as java.lang.NullPointerException.
> If i subsequently run a page which does not check for cookie, that
> non-cookie checking page loads fine; and then the cookie checking page
loads
> fine without any exception report.  It is only when the cookie checking
page
> runs FIRST that error message is generated.
>
> I am uncertain if this is some sort of jsp error or some sort of Tomcat
> error.
>
> here is code used to check for cookie, where that cookie does not exist
when
> this code generates error.  But then again, that cookie still does not
exist
> when this code works fine (ie, after running a jsp that does not check for
> cookie) - which is why i am wondering if this has something to do with
> Tomcat 4, or perhaps how it is configured???
>
>    Cookie[] cookies = request.getCookies();
>    for(int j=0; j<cookies.length; j++) {
>      cookieName = cookies[j].getName();
>      cookieValue = cookies[j].getValue();
>      if (cookieName.equals("ex")) {
>        xx = cookieValue;  // wher xx is previously defined as a String
> object
>        break;
>      }
>    }
>
> Any and all help is more than welcome, as i am a bit stumped as to how to
> begin troubleshooting this.
> -paul lomack
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to