XStream
  1. XStream
  2. XSTR-701

The result is not the expected with fromXML() when multiple addImplicitCollection and empty elements in the first

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.4.2
    • Fix Version/s: 1.4.2
    • Component/s: Core
    • Labels:
      None
    • JDK version and platform:
      jre1.6.0_14 for Windows XP

      Description

      When trying to do a fromXML() with an element with 2 addImplicitCollection
      and the first element is empty, the firs type elements are created into the second element list.

      this is an example of problematic XML:
      <test>
      <basePath>C:/WrkFld/ChkOut_mlatorre/Batch Test/Base</basePath>
      <projectPath>C:/WrkFld/ChkOut_mlatorre/Batch Test</projectPath>
      <file name="a.txt"/>
      <file name="b.txt"/>
      <dataBase name="a.txt">
      <select>A,B,C</select>
      <from>Table1, Table2</from>
      </dataBase>
      <dataBase name="b.txt">
      <select>*</select>
      <from>Table</from>
      <where>a>b</where>
      </dataBase>
      </test>

      the root element is defined like this:

      public class XMLTest

      { private String basePath; private String projectPath; private List<XMLFile> files; private List<XMLDataBase> dataBases; }

      and this is the xstream "configuration":

      xstream = new XStream();
      xstream.alias("test", XMLTest.class);
      xstream.addImplicitCollection(XMLTest.class, "files");
      xstream.addImplicitCollection(XMLTest.class, "dataBases");
      xstream.alias("dataBase", XMLDataBase.class);
      xstream.alias("file", XMLFile.class);
      xstream.useAttributeFor(XMLFile.class, "name");
      xstream.useAttributeFor(XMLDataBase.class, "name");

      Expected result:
      2 XMLDataBase Objects with their data saved into the dataBases List.
      2 XMLFile Objects with their name saved into the files List.

      Obtained result:
      2 XMLDataBase Objects with their data saved into the dataBases List. (OK)
      2 XMLFile Objects with their name saved into the dataBases List. (NOT OK)
      empty files List. (NOT OK)

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          mikeldi
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: