This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "cookies" Watch "cookies" New topic


Sonal Jogi

Joined: Oct 19, 2004
Posts: 23

Despite checking for the cookie array to be null, the below code throws a nullpointer exception at random (once in 50 times). Could anybody please tell me the reason why?

Thanks in advance,

[EDIT code tags added by Dave]
[ February 17, 2005: Message edited by: David O'Meara ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

The stack trace should state which line the NPE is occuring on.
Post your stack trace.

Also, use the code button to wrap your code. This will preserve the formatting and make it much easier for us to read.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: cookies
It's not a secret anymore!