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

Java SE 6 Additions to java.sql.Blob interface breaks backward compatibility

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6
    • core-libs
    • None
    • generic
    • generic

      Java 6 introduced a change to java.sql.Blob which introduced two new methods to the Blob interface. This breaks backward compatibility with code outside the system which either implement the interface or, as in the case encountered, a class which implemnts the interface and wraps an existing implementation in a constructor and then forwards calls to an existing implementation. I.e.

      MyBlob implements java.sql.Blob
      {
          Blob blob;

          public MyBlob( Object obj ) {
              Object transformedObject = dosomething( obj );
              blob = new SerialBlob( transformedObject );
          }

          void free() {
              blob.free();
          }
          etc...
      }

      This makes it impossible to produce code that will work on both Java 5 and 6 without resorting to reflection to determine as to whether the target (SerialBlob in this case) contains the new methods (free() and getBinaryStrem( long, long)) This issue is not raised in the compatibility release notes for Java SE6.

            lancea Lance Andersen
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: