[ 
https://issues.apache.org/jira/browse/DERBY-3898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888321#action_12888321
 ] 

Yun Lee commented on DERBY-3898:
--------------------------------

Thanks for your comment, Kristian.

NoSuchMethod errors have dissappeared after clean and rebuild.

I agree with your opinion on test code, and will provide a new patch for them.

org.apache.derbyTesting.functionTests.tests.jdbc4.BlobTest is used to test the 
JDBC 4.0 specific <code>Blob</code> methods, it does be not suitable to place 
the additional boundary test cases for setBytes(). Is it OK to use the test 
class 
org.apache.derbyTesting.functionTests.tests.jdbc4.BlobSetMethodsTest.java? Now 
BlobSetMethodsTest has only two test case for Blob.setBytes(), and it only uses 
a JDBC4 specific mothod Connection.createBlob() , maybe BlobSetMethodsTest can 
be changed to use only JDBC3 API and  moved into package 
org.apache.derbyTesting.functionTests.tests.jdbcapi, and insert additional test 
cases into it?

Others' opinions on choice between SQLException and AIOOB is welcome! Thanks!

> Blob.setBytes differs between embedded and client driver when the specified 
> length is invalid
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3898
>                 URL: https://issues.apache.org/jira/browse/DERBY-3898
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.3.0, 10.4.2.0, 10.5.1.1, 10.6.1.0
>            Reporter: Kristian Waagan
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: derby-3898-testcase.patch, derby-3898-testcase.stat, 
> Derby3898.java
>
>
> Blob.setBytes behaves differently with the embedded driver and the client 
> driver.
> Assume a 1 byte array and a specified length of 2: Blob.setBytes(1, new 
> byte[] {0x69}, 0, 2)
> Embedded: IndexOutOfBoundsException (from java.io.RandomAccessFile.writeBytes 
> or System.arraycopy)
> Client: succeeds, returns insertion count 1
> The behavior should be made consistent, but what is the correct behavior?
> From the Blob.setBytes JavaDoc:
> "Writes all or part of the given byte array to the BLOB value that this Blob 
> object represents and returns the number of bytes written. Writing starts at 
> position pos in the BLOB  value; len bytes from the given byte array are 
> written. The array of bytes will overwrite the existing bytes in the Blob 
> object starting at the position pos. If the end of the Blob value is reached 
> while writing the array of bytes, then the length of the Blob value will be 
> increased to accomodate the extra bytes."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to