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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to