Re: RFR: 8153490: Cannot setBytes() if incoming buffer's length is bigger than number of elements we want to insert. [v4]

2021-10-14 Thread Lance Andersen
On Thu, 14 Oct 2021 01:46:31 GMT, Mitsuru Kariya  wrote:

> Sorry for my very slow response.

No problem at all.  I was delayed in getting the CSR created and finalized.

> These `{@code bytes}` point to the `bytes` argument, but should I change it 
> to `{@code byte}s`?
Yes please make that minor change.Thank you

-

PR: https://git.openjdk.java.net/jdk/pull/4001


Re: RFR: 8153490: Cannot setBytes() if incoming buffer's length is bigger than number of elements we want to insert. [v4]

2021-10-13 Thread Mitsuru Kariya
On Wed, 15 Sep 2021 17:57:35 GMT, Lance Andersen  wrote:

>> Mitsuru Kariya has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Modify javadoc for consistency
>
> src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialBlob.java 
> line 337:
> 
>> 335:  * @param bytes the array of bytes to be written to the {@code BLOB}
>> 336:  * value
>> 337:  * @param offset the offset into the array {@code bytes} at which
> 
> Please change all occurrences of  `{@code bytes}` to `{@code byte}s` as this 
> was caught as part of the CSR review.

Sorry for my very slow response.
These `{@code bytes}` point to the `bytes` argument, but should I change it to 
`{@code byte}s`?

-

PR: https://git.openjdk.java.net/jdk/pull/4001


Re: RFR: 8153490: Cannot setBytes() if incoming buffer's length is bigger than number of elements we want to insert. [v4]

2021-09-15 Thread Lance Andersen
On Mon, 24 May 2021 11:18:57 GMT, Mitsuru Kariya 
 wrote:

>> Fix `SerialBlob.setBytes(long pos, byte[] bytes, int offset, int length)` in 
>> the following cases:
>> 
>> 1. `pos - 1 + bytes.length - offset > this.length() && pos - 1 + length <= 
>> this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully.
>>(test31)
>> 
>> 2. `pos - 1 + length > this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully. *1
>>(test32)
>> 
>> 3. `pos == this.length() + 1`
>>The original implementation throws `SerialException` but this case should 
>> end successfully. *2
>>(test33)
>> 
>> 4. `length < 0`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test34)
>> 
>> 5. `offset + length > Integer.MAX_VALUE`
>>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
>> `OutOfMemoryError` in most cases) but this case should throw 
>> `SerialException`.
>>(test35)
>> 
>> Additionally, fix `SerialClob.setString(long pos, String str, int offset, 
>> int length)` in the following cases:
>> 
>> 1. `offset > str.length()`
>>The original implementaion throws `StringIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test39)
>> 
>> 2. `pos - 1 + str.length() - offset > this.length() && pos - 1 + length <= 
>> this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully.
>>(test32)
>> 
>> 3. `pos - 1 + length > this.length()`
>>The original implementaion throws `SerialException` but this case should 
>> end successfully. *3
>>(test40)
>> 
>> 4. `pos == this.length() + 1`
>>The original implementaion throws `SerialException` but this case should 
>> end successfully. *4
>>(test41)
>> 
>> 5. `length < 0`
>>The original implementation throws `StringIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test42)
>> 
>> 6. `offset + length > Integer.MAX_VALUE`
>>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
>> `OutOfMemoryError` in most cases) but this case should throw 
>> `SerialException`.
>>(test43)
>> 
>> 
>> The javadoc has also been modified according to the above.
>> 
>> *1 The documentation of `Blob.setBytes()` says, "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 accommodate the extra bytes."
>> 
>> *2 The documentation of `Blob.setBytes()` says, "If the value specified for 
>> pos is greater than the length+1 of the BLOB value then the behavior is 
>> undefined."
>>So, it should work correctly when pos == length+1 of the BLOB value.
>> 
>> *3 The documentation of `Clob.setString()` says, "If the end of the Clob 
>> value is eached while writing the given string, then the length of the Clob 
>> value will be increased to accommodate the extra characters."
>> 
>> *4 The documentation of `Clob.setString()` says, "If the value specified for 
>> pos is greater than the length+1 of the CLOB value then the behavior is 
>> undefined."
>>So, it should work correctly when pos == length+1 of the CLOB value.
>
> Mitsuru Kariya has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Modify javadoc for consistency

src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialBlob.java line 
337:

> 335:  * @param bytes the array of bytes to be written to the {@code BLOB}
> 336:  * value
> 337:  * @param offset the offset into the array {@code bytes} at which

Please change all occurrences of  `{@code bytes}` to `{@code byte}s` as this 
was caught as part of the CSR review.

-

PR: https://git.openjdk.java.net/jdk/pull/4001


Re: RFR: 8153490: Cannot setBytes() if incoming buffer's length is bigger than number of elements we want to insert. [v4]

2021-08-16 Thread Lance Andersen
On Mon, 24 May 2021 11:18:57 GMT, Mitsuru Kariya 
 wrote:

>> Fix `SerialBlob.setBytes(long pos, byte[] bytes, int offset, int length)` in 
>> the following cases:
>> 
>> 1. `pos - 1 + bytes.length - offset > this.length() && pos - 1 + length <= 
>> this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully.
>>(test31)
>> 
>> 2. `pos - 1 + length > this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully. *1
>>(test32)
>> 
>> 3. `pos == this.length() + 1`
>>The original implementation throws `SerialException` but this case should 
>> end successfully. *2
>>(test33)
>> 
>> 4. `length < 0`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test34)
>> 
>> 5. `offset + length > Integer.MAX_VALUE`
>>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
>> `OutOfMemoryError` in most cases) but this case should throw 
>> `SerialException`.
>>(test35)
>> 
>> Additionally, fix `SerialClob.setString(long pos, String str, int offset, 
>> int length)` in the following cases:
>> 
>> 1. `offset > str.length()`
>>The original implementaion throws `StringIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test39)
>> 
>> 2. `pos - 1 + str.length() - offset > this.length() && pos - 1 + length <= 
>> this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully.
>>(test32)
>> 
>> 3. `pos - 1 + length > this.length()`
>>The original implementaion throws `SerialException` but this case should 
>> end successfully. *3
>>(test40)
>> 
>> 4. `pos == this.length() + 1`
>>The original implementaion throws `SerialException` but this case should 
>> end successfully. *4
>>(test41)
>> 
>> 5. `length < 0`
>>The original implementation throws `StringIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test42)
>> 
>> 6. `offset + length > Integer.MAX_VALUE`
>>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
>> `OutOfMemoryError` in most cases) but this case should throw 
>> `SerialException`.
>>(test43)
>> 
>> 
>> The javadoc has also been modified according to the above.
>> 
>> *1 The documentation of `Blob.setBytes()` says, "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 accommodate the extra bytes."
>> 
>> *2 The documentation of `Blob.setBytes()` says, "If the value specified for 
>> pos is greater than the length+1 of the BLOB value then the behavior is 
>> undefined."
>>So, it should work correctly when pos == length+1 of the BLOB value.
>> 
>> *3 The documentation of `Clob.setString()` says, "If the end of the Clob 
>> value is eached while writing the given string, then the length of the Clob 
>> value will be increased to accommodate the extra characters."
>> 
>> *4 The documentation of `Clob.setString()` says, "If the value specified for 
>> pos is greater than the length+1 of the CLOB value then the behavior is 
>> undefined."
>>So, it should work correctly when pos == length+1 of the CLOB value.
>
> Mitsuru Kariya has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Modify javadoc for consistency

In process

-

PR: https://git.openjdk.java.net/jdk/pull/4001


Re: RFR: 8153490: Cannot setBytes() if incoming buffer's length is bigger than number of elements we want to insert. [v4]

2021-06-21 Thread Lance Andersen
On Mon, 24 May 2021 11:18:57 GMT, Mitsuru Kariya 
 wrote:

>> Fix `SerialBlob.setBytes(long pos, byte[] bytes, int offset, int length)` in 
>> the following cases:
>> 
>> 1. `pos - 1 + bytes.length - offset > this.length() && pos - 1 + length <= 
>> this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully.
>>(test31)
>> 
>> 2. `pos - 1 + length > this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully. *1
>>(test32)
>> 
>> 3. `pos == this.length() + 1`
>>The original implementation throws `SerialException` but this case should 
>> end successfully. *2
>>(test33)
>> 
>> 4. `length < 0`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test34)
>> 
>> 5. `offset + length > Integer.MAX_VALUE`
>>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
>> `OutOfMemoryError` in most cases) but this case should throw 
>> `SerialException`.
>>(test35)
>> 
>> Additionally, fix `SerialClob.setString(long pos, String str, int offset, 
>> int length)` in the following cases:
>> 
>> 1. `offset > str.length()`
>>The original implementaion throws `StringIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test39)
>> 
>> 2. `pos - 1 + str.length() - offset > this.length() && pos - 1 + length <= 
>> this.length()`
>>The original implementation throws `ArrayIndexOutOfBoundsException` but 
>> this case should end successfully.
>>(test32)
>> 
>> 3. `pos - 1 + length > this.length()`
>>The original implementaion throws `SerialException` but this case should 
>> end successfully. *3
>>(test40)
>> 
>> 4. `pos == this.length() + 1`
>>The original implementaion throws `SerialException` but this case should 
>> end successfully. *4
>>(test41)
>> 
>> 5. `length < 0`
>>The original implementation throws `StringIndexOutOfBoundsException` but 
>> this case should throw `SerialException`.
>>(test42)
>> 
>> 6. `offset + length > Integer.MAX_VALUE`
>>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
>> `OutOfMemoryError` in most cases) but this case should throw 
>> `SerialException`.
>>(test43)
>> 
>> 
>> The javadoc has also been modified according to the above.
>> 
>> *1 The documentation of `Blob.setBytes()` says, "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 accommodate the extra bytes."
>> 
>> *2 The documentation of `Blob.setBytes()` says, "If the value specified for 
>> pos is greater than the length+1 of the BLOB value then the behavior is 
>> undefined."
>>So, it should work correctly when pos == length+1 of the BLOB value.
>> 
>> *3 The documentation of `Clob.setString()` says, "If the end of the Clob 
>> value is eached while writing the given string, then the length of the Clob 
>> value will be increased to accommodate the extra characters."
>> 
>> *4 The documentation of `Clob.setString()` says, "If the value specified for 
>> pos is greater than the length+1 of the CLOB value then the behavior is 
>> undefined."
>>So, it should work correctly when pos == length+1 of the CLOB value.
>
> Mitsuru Kariya has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Modify javadoc for consistency

I hope to get to the CSR this week.  Sorry for the delay

-

PR: https://git.openjdk.java.net/jdk/pull/4001


Re: RFR: 8153490: Cannot setBytes() if incoming buffer's length is bigger than number of elements we want to insert. [v4]

2021-05-24 Thread Mitsuru Kariya
> Fix `SerialBlob.setBytes(long pos, byte[] bytes, int offset, int length)` in 
> the following cases:
> 
> 1. `pos - 1 + bytes.length - offset > this.length() && pos - 1 + length <= 
> this.length()`
>The original implementation throws `ArrayIndexOutOfBoundsException` but 
> this case should end successfully.
>(test31)
> 
> 2. `pos - 1 + length > this.length()`
>The original implementation throws `ArrayIndexOutOfBoundsException` but 
> this case should end successfully. *1
>(test32)
> 
> 3. `pos == this.length() + 1`
>The original implementation throws `SerialException` but this case should 
> end successfully. *2
>(test33)
> 
> 4. `length < 0`
>The original implementation throws `ArrayIndexOutOfBoundsException` but 
> this case should throw `SerialException`.
>(test34)
> 
> 5. `offset + length > Integer.MAX_VALUE`
>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
> `OutOfMemoryError` in most cases) but this case should throw 
> `SerialException`.
>(test35)
> 
> Additionally, fix `SerialClob.setString(long pos, String str, int offset, int 
> length)` in the following cases:
> 
> 1. `offset > str.length()`
>The original implementaion throws `StringIndexOutOfBoundsException` but 
> this case should throw `SerialException`.
>(test39)
> 
> 2. `pos - 1 + str.length() - offset > this.length() && pos - 1 + length <= 
> this.length()`
>The original implementation throws `ArrayIndexOutOfBoundsException` but 
> this case should end successfully.
>(test32)
> 
> 3. `pos - 1 + length > this.length()`
>The original implementaion throws `SerialException` but this case should 
> end successfully. *3
>(test40)
> 
> 4. `pos == this.length() + 1`
>The original implementaion throws `SerialException` but this case should 
> end successfully. *4
>(test41)
> 
> 5. `length < 0`
>The original implementation throws `StringIndexOutOfBoundsException` but 
> this case should throw `SerialException`.
>(test42)
> 
> 6. `offset + length > Integer.MAX_VALUE`
>The original implementation throws `ArrayIndexOutOfBoundsException` (or 
> `OutOfMemoryError` in most cases) but this case should throw 
> `SerialException`.
>(test43)
> 
> 
> The javadoc has also been modified according to the above.
> 
> *1 The documentation of `Blob.setBytes()` says, "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 accommodate the extra bytes."
> 
> *2 The documentation of `Blob.setBytes()` says, "If the value specified for 
> pos is greater than the length+1 of the BLOB value then the behavior is 
> undefined."
>So, it should work correctly when pos == length+1 of the BLOB value.
> 
> *3 The documentation of `Clob.setString()` says, "If the end of the Clob 
> value is eached while writing the given string, then the length of the Clob 
> value will be increased to accommodate the extra characters."
> 
> *4 The documentation of `Clob.setString()` says, "If the value specified for 
> pos is greater than the length+1 of the CLOB value then the behavior is 
> undefined."
>So, it should work correctly when pos == length+1 of the CLOB value.

Mitsuru Kariya has updated the pull request incrementally with one additional 
commit since the last revision:

  Modify javadoc for consistency

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4001/files
  - new: https://git.openjdk.java.net/jdk/pull/4001/files/e4346738..69fb2f4a

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=4001=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=4001=02-03

  Stats: 38 lines in 2 files changed: 0 ins; 0 del; 38 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4001.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4001/head:pull/4001

PR: https://git.openjdk.java.net/jdk/pull/4001