8029018: (bf) Check src/share/native/java/nio/Bits.c for JNI pending excepitons
Chris Hegarty
chris.hegarty at oracle.com
Fri Jan 3 05:36:18 PST 2014
On 3 Jan 2014, at 13:33, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> The changes look fine to me.
>
> I assume that the hotspot VM will not attempt to allocation any memory and always returns a pointer to the array. So as you say, this is really just to squash the warning, but would it not be better to continue to throw the Error AND then return? Rather than just returning.
D’oh, you are assuming that on other VM’s there will be a pending exception if GetPrimitiveArrayCritical returns NULL. In which case, you could check for a pending exception and set one, if not already set, before returning. Or maybe this is just not worth it.
-Chris.
>
> -Chris.
>
> On 3 Jan 2014, at 12:41, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
>>
>> This is trivial update to Bits.c to squash a warning of potential JNI usage when there is a pending exception. This is the code that is used when copying between direct buffers of different endianness. The warning is that GetPrimitiveArrayCritical could potentially fail (with a pending exception) although in the case of HotSpot then I don't think this is possible so this change is really just to squash the warning.
>>
>> The webrev with the change is here:
>>
>> http://cr.openjdk.java.net/~alanb/8029018/webrev/
>>
>> -Alan.
>
More information about the nio-dev
mailing list