You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/07/13 13:29:45 UTC

DO NOT REPLY [Bug 30071] New: - [configuration] XMLConfiguration partially supports List properties

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: commons-dev@jakarta.apache.org
        ReportedBy: smanux@lfjr.net


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("test.attribute[@list]", "value1");
conf.addProperty("test.attribute[@list]", "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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org