XStream
  1. XStream
  2. XSTR-351

XStream with Dom4J driver fail to handle self object reference

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.x Maintenance
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      sun jdk 1.5.0_07 for windows

      Description

      marshal object with follow member create wrong reference attribute in xml file
      wrong xml output only occurs if dom4j driver is used.

      class BadSelfReference implements Serializable {
      private static final long serialVersionUID = 38772160335615698L;
      private BadSelfReference owner = this;
      private String aString = "1234";
      private Long aLong = new Long(500);
      // getter setter omitted
      }

      output
      <testcase.BadSelfReference>
      <owner reference=".."/>
      <aString reference="..">1234</aString>
      <aLong>500</aLong>
      </testcase.BadSelfReference>

      how ever, the following class can marshal correctly

      class GoodSelfReference implements Serializable {
      private static final long serialVersionUID = 38772160335615698L;
      private String aString = "1234";
      private Long aLong = new Long(500);
      private GoodSelfReference owner = this;
      // getter setter omitted
      }

      output

      <testcase.GoodSelfReference>
      <aString>1234</aString>
      <aLong>500</aLong>
      <owner reference=".."/>
      </testcase.GoodSelfReference>

        Issue Links

          People

          • Assignee:
            Unassigned
            Reporter:
            Kenny Lai
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: