On Thu, 22 Jun 2023 18:14:48 GMT, Mandy Chung <mch...@openjdk.org> wrote:

> Looks fine. It may worth refactoring the code to set an element in an utility 
> method.
> 
> ```
>     jobject obj = JNU_NewObjectByName(env, class_name, signature, value);
>     if ((*env)->ExceptionCheck(env)) {
>         return;
>     }
>     (*env)->SetObjectArrayElement(env, array, index, obj);
> ```

Thanks Mandy,

I would suggest to just do this simple change as it seems most likely to be 
correct.  We are here because a tool found the missing exception checks, not 
because this code is looked at by people frequently.  I think the common helper 
method might be more complex than what we have here.

This file rarely changes, these methods here haven't changed in forever.
There was the previous JNI exception change in this file in 2017, affecting 
other methods.
There are a couple of other changes in the file, also affecting other methods, 
and then it's the initial load in jdk8 in 2007 and probably they are the same 
before that.

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

PR Comment: https://git.openjdk.org/jdk/pull/14613#issuecomment-1603305305

Reply via email to