Test the value of url as null and length as in

try {
    if( request.getParameter( url) != null
        && request.getParameter( url).length > 1) {

        [do all your stuff]

    } else { [log an error] }
} catch()

Mark

-----Original Message-----
From: Mike Dizon [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 10:48 AM

I'm having problems with a servlet that I have written. The problem occurs
only SOMETIMES! , and I can't figure out why it works sometimes, and other
times not. The getParameter is taking in a string representation of a URL
based on input from the browser input. Such as
http://localhost/servlet?url=http://anotherwebsite.com
It works most of the time, but on some websites I get the Null Pointer
exception, and sometimes I try again and it works. Also, I did a
System.out.println(url) and it prints out as Null when I get the Null
Pointer.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to