Issue Details (XML | Word | Printable)

Key: DERBY-253
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Olav Sandstaa
Reporter: Kathey Marsden
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Client should throw not implemented exception for depricated setUnicodeStream/getUnicodeStream

Created: 01/May/05 01:33 PM   Updated: 14/May/07 04:38 PM
Return to search
Component/s: JDBC, Network Client
Affects Version/s: 10.1.1.0
Fix Version/s: 10.2.1.6

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works derby253.diff 2006-07-12 07:55 PM Olav Sandstaa 30 kB
Issue Links:
Reference
 

Issue & fix info: Release Note Needed
Resolution Date: 13/Jul/06 05:42 PM


 Description  « Hide
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

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Olav Sandstaa added a comment - 01/Jun/05 11:41 PM
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.

Kathey Marsden added a comment - 02/Jun/05 12:06 AM
Removing out of date test information to clarify the Jira entry.

Lance Andersen added a comment - 01/Dec/05 11:30 PM
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)

Olav Sandstaa added a comment - 12/Jul/06 07:55 PM
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.

Knut Anders Hatlen added a comment - 13/Jul/06 01:39 PM
The patch looks good. I will run some tests and commit it.

Knut Anders Hatlen added a comment - 13/Jul/06 04:55 PM
The tests ran cleanly. Committed revision 421570. Thanks Olav!

Olav Sandstaa added a comment - 13/Jul/06 05:01 PM
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 added a comment - 13/Jul/06 05:42 PM
Verified that the patch is in. Thanks for commiting it, Knut Anders!

Knut Anders Hatlen added a comment - 13/Jul/06 06:15 PM
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().

Olav Sandstaa added a comment - 13/Jul/06 07:40 PM
Knut Anders, thanks for the proposal to release notes. This looks very good.