[
https://jira.codehaus.org/browse/XSTR-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=293672#comment-293672
]
Max Birkoff commented on XSTR-692:
----------------------------------
I tested with Jettison 1.2.
I don't think I can afford to upgrade to jettison 1.3.1 given that it breaks
xstream's unit tests.
I think I'll just protect xstream from getting malformed JSON input; hopefully
that will be enough.
> 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>