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 30636] New: - NullPointerException in DigesterFactory
Date Thu, 12 Aug 2004 21:00:18 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30636>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30636

NullPointerException in DigesterFactory

           Summary: NullPointerException in DigesterFactory
           Product: Tomcat 5
           Version: 5.0.27
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: rgrzywinski@realityinteractive.com


A misconfigured server will cause the following:

java.lang.NullPointerException
	at org.apache.catalina.startup.DigesterFactory.register
(DigesterFactory.java:174)
	at org.apache.catalina.startup.DigesterFactory.registerLocalSchema
(DigesterFactory.java:139)
	at org.apache.catalina.startup.DigesterFactory.newDigester
(DigesterFactory.java:92)
	at org.apache.catalina.startup.ContextConfig.createWebXmlDigester
(ContextConfig.java:435)
        ...

The defect occurs because a resource is loaded from the ClassLoader and is 
never checked for null.  Lines 173 - 174 of 
org.apache.catalina.startup.DigesterFactory should be changed to:

        URL url = DigesterFactory.class.getResource(resourceURL);
        if(url == null)
            throw new WhateverIsAnAppropriateException(<"The resource 
identified by \"" + resourceURL + "\" does not exist.">);
        /* else -- the URL for the resource exists */
        schemaResolver.register(resourcePublicId , url.toString() );

where the text in <>'s is replaced with the appropriate resource bundle 
mechanism.

I would recommend that a code audit is performed to determine other such uses 
of getResource(), getResourceAsStream(), etc without appropriate null checks to 
ensure a consistent and pleasant user experience.

---------------------------------------------------------------------
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