Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Operating System: other
Platform: Other
-
25459
Description
I think there's an error in the documentation for commons-configuration
examples page.
If I use this example:
ConfigurationFactory factory = new ConfigurationFactory();
URL configURL = getClass().getResource("/config.xml");
factory.setConfigurationFileName(configURL.toString());
Configuration config = factory.getConfiguration();
I get a NPE, but if I change to this:
ConfigurationFactory factory = new ConfigurationFactory();
URL configURL = getClass().getResource("/config.xml");
- factory.setConfigurationFileName(configURL.toString());
+ factory.setConfigurationFileName(configURL.getFile());
Configuration config = factory.getConfiguration();
everthing is fine. Basically, the setConfigFileName in ConfigurationFactory is
not expecting a URI its expecting a path i think?