Review for 8130344

David Holmes david.holmes at oracle.com
Mon Jul 13 06:06:38 UTC 2015


On 11/07/2015 2:45 AM, Jean-Francois Denise wrote:
> Thanks Alan,
> I had read the spec from https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#array_operations
> And it was not clear.

FYI the spec has just been updated to clarify that the 
New<Primitive>Array functions can throw OOME if they return NULL. 
However the spec now also clarifies that an implementation that can both 
return NULL and post an exception can choose not to post the exception 
(a concession to existing VMs that only return NULL because the spec was 
inconsistent as to when OOME should be posted.)

So you do need to check for NULL, however I think it would be more 
appropriate to throw OOME in that case as that is the only reason NULL 
would be returned AFAICS.

Cheers,

David H.
--------

> On 10 Jul 2015, at 18:34, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
>>
>>
>> On 10/07/2015 16:46, Jean-Francois Denise wrote:
>>> Hi,
>>> asking review for this bug fix.
>>> http://cr.openjdk.java.net/~jfdenise/JDK-8130344/
>>>
>> I assume if JNI's NewByteArray returns NULL then it does so with a pending OOME. You might want to double check the JNI spec on this. If it guarantee it then you might need not need the null check in getStringBytes.
>>
>> The change to Image.c looks okay. In other areas of the libraries we have macros to do this.
>>
>> -Alan.
>


More information about the jigsaw-dev mailing list