Derby
  1. Derby
  2. DERBY-253

Client should throw not implemented exception for depricated setUnicodeStream/getUnicodeStream

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.1.1.0
    • Fix Version/s: 10.2.1.6
    • Component/s: JDBC, Network Client
    • Labels:
      None
    • Issue & fix info:
      Release Note Needed

      Description

      setUnicodeStream and getUnicodeStream are deprecated API's

      Network client
      PreparedStatement.setUnicodeStream() and ResultSet.getUnicodeStream() should throw not implemented exceptions rather than trying to handle these calls.

      Note: The current client implementation of setUnicodeStream() and getUnicodeStream() are broken and can cause unexpected errors

      1. derby253.diff
        30 kB
        Olav Sandstaa

        Issue Links

          Activity

          Kathey Marsden created issue -
          Daniel John Debrunner made changes -
          Field Original Value New Value
          Comment [ 64262 ]
          Olav Sandstaa made changes -
          Assignee Olav Sandstaa [ olav ]
          Olav Sandstaa made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Olav Sandstaa added a comment -

          I have had some problems trying to reproduce this problem based on the description given in the Jira report.

          The report refers to the a test named "conn/blobclob4BLOB.java", but I am unable to locate any test with name. There is a test named "jdbcapi/blobclob4BLOB.java" and initially I thought this was the right test to use, but I can not find that this test is doing any calls to setUnicodeStream/getUnicodeStream.

          There is a test called "jdbcapi/parameterMapping.java" that does a lot of calls to setUnicodeStream/getUnicodeStream which are disabled when running with the network client. I suspect this is the right test to use for reproducing this problem.

          Since I am new to the Derby code and test harness I would appreciate that someone told me if I am on the wrong track to reproduce this problem.

          Show
          Olav Sandstaa added a comment - I have had some problems trying to reproduce this problem based on the description given in the Jira report. The report refers to the a test named "conn/blobclob4BLOB.java", but I am unable to locate any test with name. There is a test named "jdbcapi/blobclob4BLOB.java" and initially I thought this was the right test to use, but I can not find that this test is doing any calls to setUnicodeStream/getUnicodeStream. There is a test called "jdbcapi/parameterMapping.java" that does a lot of calls to setUnicodeStream/getUnicodeStream which are disabled when running with the network client. I suspect this is the right test to use for reproducing this problem. Since I am new to the Derby code and test harness I would appreciate that someone told me if I am on the wrong track to reproduce this problem.
          Hide
          Kathey Marsden added a comment -

          Removing out of date test information to clarify the Jira entry.

          Show
          Kathey Marsden added a comment - Removing out of date test information to clarify the Jira entry.
          Kathey Marsden made changes -
          Description setUnicodeStream and getUnicodeStream are depricated API's and
          not supported for Network client but can throw unexpected
          error messages.

          To reproduce uncomment the "if (! isDB2jNet)" around unicode
          tests in conn/blobclob4BLOB.java

          setUnicodeStream and getUnicodeStream are deprecated API's

          Network client
          PreparedStatement.setUnicodeStream() and PreparedStatement.getUnicodeStream should throw not implemented exceptions rather than trying to handle these calls.

          Note: The current client implementation of setUnicodeStream() and getUnicodeStream() are broken and can cause unexpected errors
          Kathey Marsden made changes -
          Description setUnicodeStream and getUnicodeStream are deprecated API's

          Network client
          PreparedStatement.setUnicodeStream() and PreparedStatement.getUnicodeStream should throw not implemented exceptions rather than trying to handle these calls.

          Note: The current client implementation of setUnicodeStream() and getUnicodeStream() are broken and can cause unexpected errors
          setUnicodeStream and getUnicodeStream are deprecated API's

          Network client
          PreparedStatement.setUnicodeStream() and ResultSet.getUnicodeStream() should throw not implemented exceptions rather than trying to handle these calls.

          Note: The current client implementation of setUnicodeStream() and getUnicodeStream() are broken and can cause unexpected errors
          Hide
          Lance Andersen added a comment -

          If you are not going to implement this feature, it should throw a SQLException per section 6.2 of the JDBC 3.0 spec (same requirement in JDBC 4 though we are considering adding a new non-transient SQLException as there appears to be a SQLState that we can use... this is under discussion)

          Show
          Lance Andersen added a comment - If you are not going to implement this feature, it should throw a SQLException per section 6.2 of the JDBC 3.0 spec (same requirement in JDBC 4 though we are considering adding a new non-transient SQLException as there appears to be a SQLState that we can use... this is under discussion)
          Dyre Tjeldvoll made changes -
          Component/s JDBC [ 11407 ]
          Fix Version/s 10.2.0.0 [ 11187 ]
          Priority Minor [ 4 ] Major [ 3 ]
          Hide
          Olav Sandstaa added a comment -

          This patch replaces the existing implementation of setUnicodeStream and getUnicodeStream in the client driver to just throw a SQL exception with SQL state equal to feature not implemented.

          The following files are changed:

          M java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out
          M java/client/org/apache/derby/client/am/PreparedStatement.java
          M java/client/org/apache/derby/client/am/ResultSet.java

          The patch is ready for review and commit.

          Show
          Olav Sandstaa added a comment - This patch replaces the existing implementation of setUnicodeStream and getUnicodeStream in the client driver to just throw a SQL exception with SQL state equal to feature not implemented. The following files are changed: M java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out M java/client/org/apache/derby/client/am/PreparedStatement.java M java/client/org/apache/derby/client/am/ResultSet.java The patch is ready for review and commit.
          Olav Sandstaa made changes -
          Attachment derby253.diff [ 12336734 ]
          Olav Sandstaa made changes -
          Derby Info [Patch Available]
          Hide
          Knut Anders Hatlen added a comment -

          The patch looks good. I will run some tests and commit it.

          Show
          Knut Anders Hatlen added a comment - The patch looks good. I will run some tests and commit it.
          Hide
          Knut Anders Hatlen added a comment -

          The tests ran cleanly. Committed revision 421570. Thanks Olav!

          Show
          Knut Anders Hatlen added a comment - The tests ran cleanly. Committed revision 421570. Thanks Olav!
          Hide
          Olav Sandstaa added a comment -

          Thanks for reviewing and committing this patch, Knut Anders!

          Since this patch removes functionality from the client driver (although probably broken functionality), is this something that needs a comment in the release notes?

          Show
          Olav Sandstaa added a comment - Thanks for reviewing and committing this patch, Knut Anders! Since this patch removes functionality from the client driver (although probably broken functionality), is this something that needs a comment in the release notes?
          Olav Sandstaa made changes -
          Derby Info [Patch Available]
          Hide
          Olav Sandstaa added a comment -

          Verified that the patch is in. Thanks for commiting it, Knut Anders!

          Show
          Olav Sandstaa added a comment - Verified that the patch is in. Thanks for commiting it, Knut Anders!
          Olav Sandstaa made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Knut Anders Hatlen added a comment -

          Yes, I think we should mention this in the release notes. Here's my proposal:

          PROBLEM

          PreparedStatement.setUnicodeStream() and ResultSet.getUnicodeStream()
          throw SQLException when invoked after upgrading to Apache Derby 10.2.

          SYMPTOM

          Calling either of these methods will result in an exception with
          SQLSTATE 0A000 and message: "Feature not implemented: ..."

          CAUSE

          PreparedStatement.setUnicodeStream() and ResultSet.getUnicodeStream()
          have been deprecated since JDBC 2.0. Derby's implemetation of these
          methods was broken, and it was decided that the methods should throw a
          not-implemented exception instead of being fixed.

          SOLUTION

          This was an intentional change. No Derby product solution is offered.

          WORKAROUND

          Use setCharacterStream() and getCharacterStream() instead of
          setUnicodeStream() and getUnicodeStream().

          Show
          Knut Anders Hatlen added a comment - Yes, I think we should mention this in the release notes. Here's my proposal: PROBLEM PreparedStatement.setUnicodeStream() and ResultSet.getUnicodeStream() throw SQLException when invoked after upgrading to Apache Derby 10.2. SYMPTOM Calling either of these methods will result in an exception with SQLSTATE 0A000 and message: "Feature not implemented: ..." CAUSE PreparedStatement.setUnicodeStream() and ResultSet.getUnicodeStream() have been deprecated since JDBC 2.0. Derby's implemetation of these methods was broken, and it was decided that the methods should throw a not-implemented exception instead of being fixed. SOLUTION This was an intentional change. No Derby product solution is offered. WORKAROUND Use setCharacterStream() and getCharacterStream() instead of setUnicodeStream() and getUnicodeStream().
          Knut Anders Hatlen made changes -
          Derby Info [Release Note Needed]
          Hide
          Olav Sandstaa added a comment -

          Knut Anders, thanks for the proposal to release notes. This looks very good.

          Show
          Olav Sandstaa added a comment - Knut Anders, thanks for the proposal to release notes. This looks very good.
          Kristian Waagan made changes -
          Link This issue is related to DERBY-1615 [ DERBY-1615 ]
          Kathey Marsden made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 42165 ] Default workflow, editable Closed status [ 12800373 ]

            People

            • Assignee:
              Olav Sandstaa
              Reporter:
              Kathey Marsden
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development