[
https://issues.apache.org/jira/browse/CAMEL-8399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14334858#comment-14334858
]
Gareth Western edited comment on CAMEL-8399 at 2/24/15 1:26 PM:
----------------------------------------------------------------
Perhaps it's not that simple: XStream does not appear to handle cyclic
dependencies for JSON, only XML. As it states on [the XStream
page|http://xstream.codehaus.org/json-tutorial.html]: {quote}Since JSON has no
possibility to express references, you should always set the NO_REFERENCES mode
writing JSON.{quote}
This makes sense, although I am slightly confused because I tested the proposed
solution in our own project by extending JsonDataFormat, and it appeared to
work. So I cloned the Apache repo and wrote a patch/test for camel-xstream
however that fails. I'll look closer at the reason.
was (Author: westerg):
Perhaps it's not that simple: XStream does not appear to handle cyclic
dependencies for JSON, only XML. As it states on [the XStream
page|http://xstream.codehaus.org/json-tutorial.html]: {quote}Since JSON has no
possibility to express references, you should always set the NO_REFERENCES mode
writing JSON.{quote}
> Support setMode in JsonDataFormat
> ---------------------------------
>
> Key: CAMEL-8399
> URL: https://issues.apache.org/jira/browse/CAMEL-8399
> Project: Camel
> Issue Type: Improvement
> Components: camel-xstream
> Affects Versions: 2.14.1
> Reporter: Gareth Western
> Priority: Minor
>
> CAMEL-7592 introduced the ability to customise the XStream mode, however
> org.apache.camel.dataformat.xstream.JsonDataFormat#createXStream still sets
> the mode explicitly to NO_REFERENCES.
> I think someone just has to update the method to do the following instead:
> {code}
> if (getMode() != null) {
> xs.setMode(getModeFromString(getMode()));
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)