DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30071>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30071

[configuration] XMLConfiguration partially supports List properties

           Summary: [configuration] XMLConfiguration partially supports List
                    properties
           Product: Commons
           Version: Nightly Builds
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Configuration
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


XMLConfiguration doesn't fully support list properties, while you can call
addProperty with the same key several times to build a list of values, you can't
call addProperty directly with a List value, it results in a ClassCastException
when setXmlProperty tries to cast it into a String to create the text node.

List list = new ArrayList();
list.add("value1");
list.add("value2");

conf.addProperty("test.list", list);

Also list properties are not saved properly, the values are concatenated like this:

<configuration>
  <test>
    <list>value1value2</list>
  </test>
</configuration>

The list should appear like this instead:

<configuration>
  <test>
    <list>value1</list>
    <list>value2</list>
  </test>
</configuration>


Last issue identified, if the list is stored in an attribute:

conf.addProperty("[EMAIL PROTECTED]", "value1");
conf.addProperty("[EMAIL PROTECTED]", "value2");

only the last element is saved:

<configuration>
  <test>
    <attribute list="value2"/>
  </test>
</configuration>

It is preferable to write the list as comma separated values:

<configuration>
  <test>
    <attribute list="value1, value2"/>
  </test>
</configuration>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to