On Tue, 8 Mar 2022 20:57:27 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>>> ??? You want to check and cleanup if NewStringUTF fails. You only want to 
>>> call SetObjectElementArray if NewStringUTF succeeds.
>> 
>> If the SetObjectArrayElement will throw an exception we will call the 
>> NewStringUTF while the exception is raised which is a kind of "jni" issue. 
>> If such an exception is possible we should check and cleanup.
>
> A quick search for `SetObjectArrayElement` in `java.desktop` module shows the 
> call to `SetObjectArrayElement` is rarely followed by exception check.
> 
> What kind of exception can `SetObjectArrayElement` raise if the index is 
> within the range and the stored element is of correct type?

I think `NewStringUTF()` can throw OOM and also return `NULL`, just which one 
you pick.

-------------

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

Reply via email to