XStream
  1. XStream
  2. XSTR-245

Broken XML output serializing class with custom writeObject()

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      Sun 1.4.2_09 for Windows

      Description

      XStream generates bad XML of Class1 has a transient field class2 of type Class2 and has a custom writeObject() method that writes class2 before calling defaultWriteObject(). Class2 has a custom writeObject() method that simply calls defaultWriteObject(). The default section for Class1duplicates the default section for Class2 rather than the declared fields of Class1.

      I wasn't sure how to generate a JUnit test for this, but I've attached a simple, stand-alone Java file with a simple test case that writes the XML to System.out.

      1. Class1.java
        1 kB
        Philip Gust
      2. Class1.xml
        0.4 kB
        Philip Gust
      3. SerializableConverterTest.java
        4 kB
        Cyrille Le Clerc
      4. XSTR-245.patch
        22 kB
        Cyrille Le Clerc
      5. XSTR-245-0.1-draft.patch
        20 kB
        Cyrille Le Clerc

        People

        • Assignee:
          Unassigned
          Reporter:
          Philip Gust
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: