commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Migowski <>
Subject [commons-configuration] XMLConfiguration XPathExpressionEngine saving Lists error
Date Tue, 24 Mar 2009 09:21:34 GMT

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:
   <liste>eintrag 1</liste>
   <liste>eintrag 2</liste>
   <liste>eintrag 3</liste>


    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

            test.remove("eintrag 2");
            masterconfig.setProperty("liste", test); //ok, one <liste>
element is removed from file

            test.add("neuer eintrag");
            masterconfig.setProperty("liste", test); //exception

        } catch (Exception e) {

I think commons-configuration should work consistent on all this cases.

best regards,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message