Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5088649

SerialBlob, SerialClob, etc. SQL type objects not fully serializable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 5.0
    • core-libs
    • x86
    • windows_2000



      Name: gm110360 Date: 08/18/2004


      FULL PRODUCT VERSION :
      source code bug

      ADDITIONAL OS VERSION INFORMATION :
      All operating systems, source code bug

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      source code bug

      A DESCRIPTION OF THE PROBLEM :
      I've tested the serializable wrappers of extended SQL types that have been introduced in the new Tiger version SerialBlob, SerialClob, SerialStruct, etc. from the new 'rowset' package.

      When trying to serialize objects of these wrapper types that are constructed upon the original Blob, Clob implementation underlying objects (received during JDBC SQL connection session) I often get 'NotSerializableException'.

      When I looked at the source code (classes SerialBlob, SerialClob, etc.) I found an error in that the underlying JDBC-specific type implementing Blob and Clob interfaces is stored in the corresponding wrapper class as a standard field that is therefore part of serialization.

      However, such an underlying Blob, Clob implementation (produced solely by JDBC vendors) is opaque where no any presumption about it's internal structure can be made. It's dangerous to include such object to a serializable wrapper because the object can be inherently non-serializable and can flaw the resulting serializability.

      Underlying Blob, Clob objects (the objects received from JDBC drivers which the serializable wrappers are based upon) should be declared 'transient' and the corresponding wrapper class must be able to correctly deserialize serialized object without using the underlying type.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This error occurs whenever a SerialBlob, SerialBlob (and possibly some others) wrapper object based on a non-serializable underlying Blob, Clob interface implementation object is being serialized.
      The underlying Blob, Clob, Struct, etc. interface implementation is provided by JDBC vendors and is rarely serializable.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The serializable wrappers should be fully serializable.
      ACTUAL -
      see above

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      see above

      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------
      see above
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is no workaround. A wrapper source code modification is required:

      - declare underlying Blob, Clob, Struct, Ref, etc. members as 'transient', and store state-specific attributes in some serializable helper objects if necessary

      - check whether object deserialization restores serialized object having to a correct state so that all Blob, Clob, etc. interface methods behave correctly.
      (Incident Review ID: 297422)
      ======================================================================

            Unassigned Unassigned
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: