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=31041>.
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=31041

[configuration] Invalid resource names in XMLConfiguration generate a NPE

           Summary: [configuration] Invalid resource names in
                    XMLConfiguration generate a NPE
           Product: Commons
           Version: Nightly Builds
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Configuration
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


XMLConfiguration throws a NullPointerException if an invalid resource name is
passed to its constructor, it should throw a ConfigurationException explaining
the issue instead.

Fix suggested by Ben Hutchison:

private static File resourceURLToFile(String resource) {
        URL confURL = XMLConfiguration.class.getClassLoader().getResource(resource);
        if (confURL == null) {
            confURL = ClassLoader.getSystemResource(resource);
        }
        if (confURL == null)
                throw new IllegalArgumentException("Resource:"+resource+" not found
thru context or system classloaders.");
        return new File(confURL.getFile());
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to