can anyone tell me why this throws a java.lang.NullPointerException ?

public String getCookieExists(){
  String strStatus = "no errors";
  Cookie info;
  try{
   if (request.getCookies() != null){
    Cookie[] cookies = request.getCookies(); //null exception from here
    if (cookies.length !=0 && cookies != null){
     for (int i = 0; i < cookies.length ; i++){
      info = cookies[i];
      if (info != null){
       strStatus = info.getName().equals(strCookieLookingFor) &&
strCookieLookingFor != null ? "exists" : "doesnt exist";
      }
     }
    }
   }
  }
  catch(Exception e){
   strStatus = (e.toString() + " <b>(from bean)</b>");
  }

  return strStatus;
 }

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to