"Craig R. McClanahan" wrote:
> Son To wrote:
>
> > you can look at the src at
> > http://hrn1198.resnet-student.upenn.edu/~son/src/auth.jar
> >
>
> Gives a "not found" error.
>
> >
> > I appreciate any feed back
> >
> > thanks,
> > son
> >
>
> Craig
>
With a little further snooping, I was able to read
AuthenticateServlet.java and Database.java in your directory. If this
is really the same code you are talking about, here's a couple of notes:
* No JNI code at all, at least not here. The MySQL JDBC driver
you are using (a good one, by the way), is pure Java.
* The most likely problem is in your Database.getDataSet() method.
If it throws an SQLException before "d" is initialized, you
will be returning a null value at the end of the function.
Just one example scenario that will trigger a null pointer in this way
is if someone types in a username with a single quote character in it.
This will create an invalid SQL statement, which will cause
executeQuery() to throw an SQLException (with the value of "d" still set
to null). You can get around this particular problem by using a
PreparedStatement instead -- see the JDBC docs for more info.
But the bottom line is, this servlet code is in error because it does
not check for the case where a null value is returned.
Craig
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]