Hi,
is this considered a bug:
If I load a list with commons-configuration, then add new entries to
that list and try to save it back to file, I get a
"java.lang.IllegalArgumentException: prepareAdd: Passed in key must
contain a whitespace!" exception.
If I do not modify the list, saving works.
If I remove entries from the list, saving works as well.
Very simple demo-program:
XML File:
<config>
<liste>eintrag 1</liste>
<liste>eintrag 2</liste>
<liste>eintrag 3</liste>
</config>
program:
public static void main(String[] args) {
XMLConfiguration masterconfig;
try {
masterconfig = new XMLConfiguration("democonfig.xml");
masterconfig.setExpressionEngine(new XPathExpressionEngine());
List<String> test = masterconfig.getList("liste");
masterconfig.setProperty("liste", test); //ok, no changes
masterconfig.save();
test.remove("eintrag 2");
masterconfig.setProperty("liste", test); //ok, one <liste>
element is removed from file
masterconfig.save();
test.add("neuer eintrag");
masterconfig.setProperty("liste", test); //exception
masterconfig.save();
} catch (Exception e) {
e.printStackTrace();
}
}
I think commons-configuration should work consistent on all this cases.
best regards,
christian!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]