RFR: 8299684: (bf) JNI direct buffer functions with large capacity behave unexpectedly [v5]
Brian Burkhalter
bpb at openjdk.org
Wed Jan 11 17:27:32 UTC 2023
On Tue, 10 Jan 2023 11:58:03 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8299684: Changes addressing reviewer comments
>
> test/jdk/java/nio/jni/NewDirectByteBuffer.java line 30:
>
>> 28: * @summary Verify that JNI NewDirectByteBuffer throws IllegalArgumentException
>> 29: * if the capacity is negative or greater than Integer::MAX_VALUE
>> 30: * @run main/native NewDirectByteBuffer
>
> You may have missed the comments about @requires and wondering if this test will run on 32-bit, as it will attempt to malloc 2GB.
I saw the comments but was deferring that.
> test/jdk/java/nio/jni/NewDirectByteBuffer.java line 50:
>
>> 48: (long)Integer.MAX_VALUE + 1L,
>> 49: 3_000_000_000L,
>> 50: 5_000_000_000L
>
> Long.MIN_VALUE and Long.MAX_VALUE would be good to include.
Added in 82d9e6f1f6782b180943d1136881d58dd2852e58.
> test/jdk/java/nio/jni/libNewDirectByteBuffer.c line 35:
>
>> 33: void* addr = malloc(size);
>> 34: if (addr == NULL) {
>> 35: jclass rtExCls = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
>
> rtExCls? Does this stand for "runtime exception class", just asking because this is an Error class.
Thanks for catching that. The name `rtExCls` is as you interpreted and is residual from an unpublished version. Fixed in 82d9e6f1f6782b180943d1136881d58dd2852e58.
-------------
PR: https://git.openjdk.org/jdk/pull/11873
More information about the nio-dev
mailing list