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

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • None
    • Affects Version/s: 6
    • Component/s: 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.

            Assignee:
            Lance Andersen
            Reporter:
            J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: