[ 
https://jira.codehaus.org/browse/XSTR-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=293621#comment-293621
 ] 

Joerg Schaible commented on XSTR-692:
-------------------------------------

I fear there's not a lot that XStream can do here. If you look at the stack 
trace, you see that Jettison gets confused by this input. I am quite sure I can 
provoke this behavior using Jettison only. Can you confirm that you're using 
Jettison 1.2 (that's what XStream has been tested with)?

There are newer Jettison versions (latest 1.3.1), you may give it a try 
instead. However, from a short test I had to recognize that this version breaks 
XStream's unit tests, because it produces now a slightly different JSON 
structure which means in consequence the structure it can read is also 
different now.
                
> OutOfMemory Exception during a parse error
> ------------------------------------------
>
>                 Key: XSTR-692
>                 URL: https://jira.codehaus.org/browse/XSTR-692
>             Project: XStream
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.4.2
>            Reporter: Max Birkoff
>            Assignee: Joerg Schaible
>
> I sent the following stack trace in email before realizing that I should file 
> a bug instead.
> Using this program:
> {code:java}
> import com.thoughtworks.xstream.XStream;
> import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
> import java.util.Map;
> public class XstreamTest {
>     private static XStream createXStream() {
>         XStream xstream = new XStream(new JettisonMappedXmlDriver());
>         xstream.setMode(XStream.NO_REFERENCES);
>         xstream.autodetectAnnotations(false);
>         xstream.alias("state", Map.class);
>         return xstream;
>     }
>     public static void main(String[] argv) {
>         XStream xstream = createXStream();
>         String s = 
> "{\"xxx.xxxxxxx.xx.xxxxxxxx.xxxxxxx.xxxxxxxxxxxxxx\":[{\"map\":[{\"entry\":[{\"string\":[\"v\",";
>         System.out.println(s);
>         Object o = xstream.fromXML(s);
>     }
> }
> {code}
> I get this output/exception:
> {noformat}
> {"xxx.xxxxxxx.xx.xxxxxxxx.xxxxxxx.xxxxxxxxxxxxxx":[{"map":[{"entry":[{"string":["v",
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
>     at java.util.Arrays.copyOf(Arrays.java:2760)
>     at java.util.Arrays.copyOf(Arrays.java:2734)
>     at java.util.ArrayList.ensureCapacity(ArrayList.java:167)
>     at java.util.ArrayList.add(ArrayList.java:351)
>     at org.codehaus.jettison.json.JSONArray.<init>(JSONArray.java:107)
>     at org.codehaus.jettison.json.JSONTokener.nextValue(JSONTokener.java:313)
>     at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:195)
>     at org.codehaus.jettison.json.JSONTokener.nextValue(JSONTokener.java:310)
>     at org.codehaus.jettison.json.JSONArray.<init>(JSONArray.java:110)
>     at org.codehaus.jettison.json.JSONTokener.nextValue(JSONTokener.java:313)
>     at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:195)
>     at org.codehaus.jettison.json.JSONTokener.nextValue(JSONTokener.java:310)
>     at org.codehaus.jettison.json.JSONArray.<init>(JSONArray.java:110)
>     at org.codehaus.jettison.json.JSONTokener.nextValue(JSONTokener.java:313)
>     at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:195)
>     at org.codehaus.jettison.json.JSONTokener.nextValue(JSONTokener.java:310)
>     at org.codehaus.jettison.json.JSONArray.<init>(JSONArray.java:110)
>     at org.codehaus.jettison.json.JSONTokener.nextValue(JSONTokener.java:313)
>     at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:195)
>     at 
> org.codehaus.jettison.mapped.MappedXMLInputFactory.createXMLStreamReader(MappedXMLInputFactory.java:43)
>     at 
> org.codehaus.jettison.AbstractXMLInputFactory.createXMLStreamReader(AbstractXMLInputFactory.java:151)
>     at 
> com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver.createReader(JettisonMappedXmlDriver.java:85)
>     at com.thoughtworks.xstream.XStream.fromXML(XStream.java:912)
>     at com.thoughtworks.xstream.XStream.fromXML(XStream.java:903)
>     at XstreamTest.main(XstreamTest.java:25)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a 
href="http://xircles.codehaus.org/manage_email";>http://xircles.codehaus.org/manage_email</a>
</p>

Reply via email to