Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.0
-
None
-
None
-
None
-
Operating System: Windows XP
Platform: PC
-
32797
Description
Hello,
I just identified a new issue with HierarchicalXMLConfiguration. The method
setProperty does not sets a property correctly.
Try out this simple piece of code:
Configuration myHierarchicalXMLConfig = new HierarchicalXMLConfiguration();
Configuration myXMLConfig = new XMLConfiguration();
myHierarchicalXMLConfig.setProperty("A.B", "valueAB");
myHierarchicalXMLConfig.setProperty("A", "valueA");
myXMLConfig.setProperty("A.B", "valueAB");
myXMLConfig.setProperty("A", "valueA");
System.out.println("myHierarchicalXMLConfig.getProperty(\"A.B\")"
+ myHierarchicalXMLConfig.getProperty("A.B"));
System.out.println("myXMLConfig.getProperty(\"A.B\")"
+ myXMLConfig.getProperty("A.B"));
The output on my WinXP system with the 1.0 release of commons configuration
using Java 1.4.2_06 is the following:
myHierarchicalXMLConfig.getProperty("A.B")null
myXMLConfig.getProperty("A.B")valueAB
I would expect both implementations of the interface Configuration to behave the
same way. This means that also myHierarchicalXMLConfig would keep its property
"A.B" with the associated value "valueAB" after inserting the key "A".
The problem occurs in a real world scenario, if I allow my application to change
values stored in the configuration before, i.e., if I try to set a new value for
"A" after the whole configuration has been read in.
Just using XMLConfiguration instead serves as a workaround, but I cannot save a
XMLConfiguration at the moment (see solved issue 32240).
It would be nice, if this could be fixed.
Best regards,
Christian Kemmer