Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-417

java.io.StreamCorruptedException: defaultWriteObject or writeFields not called on the sender's side

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Blocker
    • Resolution: Unresolved
    • None
    • 2.0.0
    • None
    • None

    Description

      The exception is an expected behavior as the implementation of the
      DynaProperty.readObject and DynaProperty.writeObject do not adhere to
      the serialization specifications.

      When I looked at the implementation of the write/readObject in
      org.apache.commons.beanutils.DynaProperty at the link -
      (
      http://javasourcecode.org/html/open-source/commons-beanutils/commons-bea
      nutils-1.8.1/org/apache/commons/beanutils/DynaProperty.java.html)
      I see that they do not adhere to the serialization specification
      (
      http://docs.oracle.com/javase/7/docs/platform/serialization/spec/output.
      html#861)
      which states the following -
      Either ObjectOutputStream's defaultWriteObject or writeFields method
      must be called once (and only once) before writing any optional data
      that will be needed by the corresponding readObject method to restore
      the state of the object; even if no optional data is written,
      defaultWriteObject or writeFields must still be invoked once. If
      defaultWriteObject or writeFields is not invoked once prior to the
      writing of optional data (if any), then the behavior of instance
      deserialization is undefined in cases where the ObjectInputStream cannot
      resolve the class which defined the writeObject method in question.
      ------------------------------------------------------------------------
      The defaultWriteObject or writeFields have to be invoked prior to
      writing any data.

      A fix was added to the Java 6 SR10 onwards (IX90079), to catch incorrect
      implementations of the read/writeObjects. Hence, the exception is seen
      with WAS 7.

      3182 [8/24/12 12:13:45:967 EDT] 00000034 ORBRas 3 com.ibm.rmi.io.IIOPInputStream invokeObjectReader:1812 ORB.thread.pool : 0 The following exception was logged
      3183 java.lang.reflect.InvocationTargetException
      3184 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      3185 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
      3186 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3187 at java.lang.reflect.Method.invoke(Method.java:600)
      3188 at com.ibm.rmi.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1809)
      3189 at com.ibm.rmi.io.IIOPInputStream.inputObjectUsingClassDesc(IIOPInputStream.java:1529)
      3190 at com.ibm.rmi.io.IIOPInputStream.inputObjectClassDesc(IIOPInputStream.java:1504)
      3191 at com.ibm.rmi.io.IIOPInputStream.readSerializable(IIOPInputStream.java:1178)
      3192 at com.ibm.rmi.io.IIOPInputStream.simpleReadObjectInternal(IIOPInputStream.java:460)
      3193 at com.ibm.rmi.io.IIOPInputStream.simpleReadObjectLoop(IIOPInputStream.java:545)
      3194 at com.ibm.rmi.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:497)
      3195 at com.ibm.rmi.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:210)
      3196 at com.ibm.rmi.iiop.CDRReader.read_value(CDRReader.java:1578)
      3197 at com.ibm.rmi.iiop.ObjectCopierFactory$AbstractArrayCopier.doWork(ObjectCopierFactory.java:424)
      3198 at com.ibm.rmi.iiop.ObjectCopierFactory$AbstractCopier.invoke(ObjectCopierFactory.java:229)
      3199 at $Proxy24.doWork(Unknown Source)
      3200 at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
      3201 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1613)
      3202 Caused by: java.io.StreamCorruptedException: defaultWriteObject or writeFields not called on the sender's side
      3203 at com.ibm.rmi.io.IIOPInputStream.defaultReadObject(IIOPInputStream.java:681)
      3204 at org.apache.commons.beanutils.DynaProperty.readObject(DynaProperty.java:281)
      3205 ... 18 more

      Attachments

        1. BEANUTILS-417.patch
          3 kB
          Jiri Holy

        Activity

          People

            Unassigned Unassigned
            jaladikm krisha
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: