Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cascading writeReplace() methods creates invalid xml (duplicate resolves-to) #76

Closed
rscadrde opened this issue Oct 27, 2016 · 4 comments

Comments

@rscadrde
Copy link

commented Oct 27, 2016

When using toXml() on a JPA list there maybe to delegates for list which let
XStream create a duplicate attribute "resolves-to":
<org.apache.openjpa.kernel.DelegatingResultList resolves-to="org.apache.openjpa.lib.rop.EagerResultList" resolves-to="list">
using fromXml then fails with

com.thoughtworks.xstream.io.StreamException: 
    at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
    at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
    at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1085)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1076)
Caused by: org.xmlpull.v1.XmlPullParserException: duplicated attributes resolves-to and resolves-to (position: START_DOCUMENT seen ...o="org.apache.openjpa.lib.rop.EagerResultList" resolves-to="list">... @1:124) 
    at org.xmlpull.mxp1.MXParser.parseStartTag(MXParser.java:1891)
    at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1479)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)

Here is a short test failing on xstream 1.4.9: XStream149Test.java in
XStream149Test.zip

@rscadrde rscadrde changed the title Cascading writeReplace() methods create invalid xml (duplicate resolves-to) Cascading writeReplace() methods creates invalid xml (duplicate resolves-to) Oct 27, 2016
@rscadrde

This comment has been minimized.

Copy link
Author

commented Oct 27, 2016

org.xmlpull.mxp1.MXParser comes out of our dependency xpp3_min-1.1.4c.jar

@rscadrde

This comment has been minimized.

Copy link
Author

commented Oct 27, 2016

With kxml2-min the error does not come up.

rscadrde pushed a commit to rscadrde/xstream that referenced this issue Oct 27, 2016
rscadrde pushed a commit to rscadrde/xstream that referenced this issue Oct 27, 2016
@rscadrde

This comment has been minimized.

Copy link
Author

commented Oct 27, 2016

When you remove

<dependency>
  <groupId>net.sf.kxml</groupId>
  <artifactId>kxml2-min</artifactId>
  <optional>true</optional>
</dependency>

<dependency>
  <groupId>net.sf.kxml</groupId>
  <artifactId>kxml2</artifactId>
  <optional>true</optional>
</dependency>

out of the pom.xml the test out of the pull request fails as expected.
#77

rscadrde pushed a commit to rscadrde/xstream that referenced this issue Oct 27, 2016
rscadrde pushed a commit to rscadrde/xstream that referenced this issue Oct 27, 2016
@joehni joehni added the bug label Oct 27, 2016
@joehni joehni added this to the 1.4.x milestone Oct 27, 2016
@joehni joehni self-assigned this Oct 27, 2016
@joehni

This comment has been minimized.

Copy link
Member

commented Oct 27, 2016

Thanks for the test and fix. As you've already found out, it had nothing to do with the XML parser dependencies. Actually, I never thought about a cascaded writeReplace ...

@joehni joehni closed this in bf47dd9 Nov 6, 2016
joehni added a commit that referenced this issue Nov 6, 2016
@joehni joehni modified the milestones: 1.4.x, 1.4.10 Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.