Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.4, 1.5, Nightly Builds
-
None
-
None
-
Sun JDK 1.5.0-13 on Debian GNU/Linux
Description
The subject says it all, the following code reproduces it. The two commented lines work around the bug: The first one fixes the NullPointerException, but destroys the name of the root element; the second arranges for the name being recreated.
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.SubnodeConfiguration;
import org.apache.commons.configuration.XMLConfiguration;
public class Tester {
public static void main(String[] args) throws ConfigurationException
}
Here comes a simple configuration file to use (test.xml):
<?xml version="1.0" encoding="utf-8"?>
<a>
<b>
<c />
</b>
</a>
And here a Stracktrace against http://svn.apache.org/repos/asf/commons/proper/configuration/trunk@603551:
Exception in thread "main" java.lang.NullPointerException
at org.apache.commons.configuration.XMLConfiguration$XMLBuilderVisitor.insert(XMLConfiguration.java:1188)
at org.apache.commons.configuration.HierarchicalConfiguration$BuilderVisitor.visitBeforeChildren(HierarchicalConfiguration.java:1642)
at org.apache.commons.configuration.HierarchicalConfiguration$Node.visit(HierarchicalConfiguration.java:1319)
at org.apache.commons.configuration.XMLConfiguration$XMLBuilderVisitor.processDocument(XMLConfiguration.java:1153)
at org.apache.commons.configuration.XMLConfiguration.createDocument(XMLConfiguration.java:621)
at org.apache.commons.configuration.XMLConfiguration.save(XMLConfiguration.java:711)
at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration$FileConfigurationDelegate.save(AbstractHierarchicalFileConfiguration.java:448)
at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:544)
at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:511)
at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.save(AbstractHierarchicalFileConfiguration.java:214)
at Tester.main(Tester.java:14)