RFR: 8299684: (bf) JNI direct buffer functions with large capacity behave unexpectedly [v16]
Brian Burkhalter
bpb at openjdk.org
Fri Jan 20 17:26:25 UTC 2023
On Thu, 19 Jan 2023 07:53:15 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> test/jdk/java/nio/jni/NewDirectByteBuffer.java line 130:
>>
>>> 128: void illegalCapacities(long capacity) {
>>> 129: assertThrows(IllegalArgumentException.class, () -> {
>>> 130: long addr = UNSAFE.allocateMemory(capacity);
>>
>> How is `allocateMemory` going to respond to these illegal capacity requests?
>>
>> If we expect `newDirectByteBuffer` to throw then can't we use a dummy buffer value as it will never be used?
>
>> How is `allocateMemory` going to respond to these illegal capacity requests?
>>
>> If we expect `newDirectByteBuffer` to throw then can't we use a dummy buffer value as it will never be used?
>
> For illegalCapacities it should call allocateMemory with some fixed value, say 1, not capacity. Surprised the allocateMemory isn't failing for the test inputs.
Changed allocation size to `1` in `illegalCapacities` in 3b1eef25b53dbeb36e4b3a8d6c279a5e0f5a5ae3.
-------------
PR: https://git.openjdk.org/jdk/pull/11873
More information about the nio-dev
mailing list