tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15795] - Request with mailformed URL causes NullPointerException
Date Wed, 09 Jul 2003 14:06:41 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15795>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15795

Request with mailformed URL causes NullPointerException





------- Additional Comments From ian.sollars@gmx.net  2003-07-09 14:06 -------
I have the same thing with the exact same stacktrace.

I think the problem is in FileDirContext.java. The javadoc for 
FileDirContext.file(String name) says it should return null if !(file.exists() 
&& file.canRead()). However, before it does that test it calls File(String 
base, String name) without checking for a null argument on name. File then does 
this:

    public File(File parent, String child) {
//!!        -->              ^^unchecked null
        if (child == null) {
            throw new NullPointerException();
        }
        
        ...

My quick suggestion for a fix is this, at FileDirContext.java:879:

        if(name == null) return null;

This should stop Catalina from throwing NullPointers for borken URLs and bring 
the behaviour inline with the javadoc comment. Whether there's another method 
that is returning null when it shouldn't, I haven't checked.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message