XStream
  1. XStream
  2. XSTR-589

DataHolder issue with XStream while marshaling

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.3.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      JDK1.6 , WebSpherer Application ServerV7.0.0.3 and Windows XP

      Description

      recently we are upgrade the XStream from v1.1.2 to v1.3.1 and we are facing the below problem.
      we are running this application wiht WebSphere Application Server V7.0.0.3 JDK 1.6

      code snippet:

      Writer buffer = new StringWriter();
      PureJavaReflectionProvider reflectionProvider = new PureJavaReflectionProvider();
      XmlFriendlyReplacer xfr = new XmlFriendlyReplacer("$","_");

      XStream xstream = new XStream(reflectionProvider,new XppDriver());
      xstream.setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy());

      String tagname="HellowWorld";
      String tagval="Hello srinivas";
      HierarchicalStreamWriter writer=new PrettyPrintWriter(buffer,xfr);
      //below statement is producsing double underscore
      writer.startNode("ROOT_ELEMENT");
      DataHolder dataHolder=xstream.newDataHolder();
      dataHolder.put("OBJECT_NAME","HellowWorld");
      xstream.marshal(tagval, writer,dataHolder);
      writer.endNode();
      writer.close();

      String retval=buffer.toString();
      System.out.println(""+buffer.toString());

      out put from the above code :
      <ROOT_ELEMENT>
      <string>Hello srinivas</string>
      </ROOT_ELEMENT>

      but if you runt the same code wiht the XStream1.1.2 in JDK1.5 we are getting the below out put (we reqire the below output)
      <ROOT_ELEMENT>
      <HelloWorldString class="string">Hello from epc-srinivasv-wxp server </HelloWorldString>
      </ROOT_ELEMENT>

      is it the bug in wiht latest XStream jar or some thing wrong wiht the program

        People

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

          Dates

          • Created:
            Updated:
            Resolved: