XStream
  1. XStream
  2. XSTR-692

OutOfMemory Exception during a parse error

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • JDK version and platform:
      Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

      Description

      I sent the following stack trace in email before realizing that I should file a bug instead.

      Using this program:

      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);
          }
      }
      

      I get this output/exception:

      {"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)
      

        People

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

          Dates

          • Created:
            Updated:
            Resolved: