commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claude Warren (JIRA)" <>
Subject [jira] [Created] (CONFIGURATION-641) XMLConfiguration.load may throw NPE
Date Sat, 19 Nov 2016 23:40:58 GMT
Claude Warren created CONFIGURATION-641:

             Summary: XMLConfiguration.load may throw NPE
                 Key: CONFIGURATION-641
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 2.1
         Environment: Java 8 / Linux
            Reporter: Claude Warren

I expect that 
    URL url = Test.class.getResource( "/Test.xml");	
    XMLConfiguration config = new XMLConfiguration(); url.openStream());

Would read the XML file.  However it will throw a NPE at line 967

 private void load(InputSource source) throws ConfigurationException
            URL sourceURL = locator.getSourceURL(); // <- NPE here
            if (sourceURL != null)

I believe that testing for locator == null first will solve the problem as the rest of the
code in the method does not appear to use it.

This message was sent by Atlassian JIRA

View raw message