Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-4904

HHH-4441 SessionImpl serialization violates java serialization spec

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • EAP_EWP 5.1.1
    • EAP_EWP 5.1.0_CR1, EAP_EWP 5.1.0_CR2
    • Hibernate
    • None
    • Release Notes
    • Hide
      JBoss Marshalling failed to serialize a session, due to a flaw in the serialization logic of <classname>org.hibernate.impl.SessionImpl</classname>. This class now adheres to the Java Serialization specification listed at http://java.sun.com/javase/6/docs/platform/serialization/spec/output.html#86, and serialization works properly and as expected.
      Show
      JBoss Marshalling failed to serialize a session, due to a flaw in the serialization logic of <classname>org.hibernate.impl.SessionImpl</classname>. This class now adheres to the Java Serialization specification listed at http://java.sun.com/javase/6/docs/platform/serialization/spec/output.html#86, and serialization works properly and as expected.
    • Documented as Resolved Issue

    Description

      http://opensource.atlassian.com/projects/hibernate/browse/HHH-4441
      ---------------

      The private serialization methods of org.hibernate.impl.SessionImpl must call default[Read|Write]Object() on the object input/output stream before any custom de/serialization logic.

      According to the Java serialization spec:
      http://java.sun.com/javase/6/docs/platform/serialization/spec/output.html#861
      "The class's writeObject method, if implemented, is responsible for saving the state of the class. 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."

      http://java.sun.com/javase/6/docs/platform/serialization/spec/input.html#2971
      "The readObject method of the class, if implemented, is responsible for restoring the state of the class. The values of every field of the object whether transient or not, static or not are set to the default value for the fields type. Either ObjectInputStream's defaultReadObject or readFields method must be called once (and only once) before reading any optional data written by the corresponding writeObject method; even if no optional data is read, defaultReadObject or readFields must still be invoked once."

      Attachments

        Activity

          People

            shaozliu Strong Liu(刘少壮) (Inactive)
            shaozliu Strong Liu(刘少壮) (Inactive)
            Misty Stanley-Jones Misty Stanley-Jones (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: