Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-106

StreamCorruptedException when reading nested subclasses

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 1.2.0.GA, 1.3.0.CR2
    • River
    • None

    Description

      Trying to serialize nested subclasses of a nested class cause errors like this:

      java.io.StreamCorruptedException: Unexpected byte found when reading an object: 50
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:708)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:207)
      at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1637)
      at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1553)
      at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1517)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1202)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:270)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:207)
      at org.jboss.marshalling.AbstractUnmarshaller.readObject(AbstractUnmarshaller.java:85)
      at org.infinispan.marshall.LowerLevelMarshall534545Test.test001(LowerLevelMarshall534545Test.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:546)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
      at org.testng.TestRunner.runWorkers(TestRunner.java:908)
      at org.testng.TestRunner.privateRun(TestRunner.java:617)
      at org.testng.TestRunner.run(TestRunner.java:498)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:329)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:324)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:296)
      at org.testng.SuiteRunner.run(SuiteRunner.java:201)
      at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
      at org.testng.TestNG.run(TestNG.java:787)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75)
      at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:79)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
      Caused by: an exception which occurred:
      in field id
      in object of type org.infinispan.marshall.LowerLevelMarshall534545Test$Child2

      The issue, as correctly identified by Mihir Patel, is that when reading such Child2, RiverUnmarshaller detects parent to be incomplete and hence it does not read parent's attributes. This is a problem because on the marshalling side, parent's attributes are written before Child2's, hence the mismatch between the write and reading phase.

      Attachments

        Issue Links

          Activity

            People

              dlloyd@redhat.com David Lloyd
              rh-ee-galder Galder ZamarreƱo
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: