RFR: 8296709: WARNING: JNI call made without checking exceptions [v5]

Chris Plummer cjplummer at openjdk.org
Mon Nov 14 18:21:25 UTC 2022


On Mon, 14 Nov 2022 14:19:48 GMT, Lutz Schmidt <lucy at openjdk.org> wrote:

>> This small change fixes a warning that may pop up during runtime. May I please request reviews? Thank you!
>
> Lutz Schmidt has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8296709: use multiple @run tags instead of multiple files

This is the problematic code:


/* Get all loaded classes (must be inside a WITH_LOCAL_REFS) */
jvmtiError
allLoadedClasses(jclass **ppclasses, jint *pcount)
{
    jvmtiError error;

    *pcount = 0;
    *ppclasses = NULL;
    error = JVMTI_FUNC_PTR(gdata->jvmti,GetLoadedClasses)
                (gdata->jvmti, pcount, ppclasses);
    return error;
}


It seems there are a few places where `allLoadedClasses()` is called with either no `WITH_LOCAL_REFS`, or with an inadequate one. However, given that the number of jni localrefs to be allocated is unknown a potentially very large, I'm not sure how callers of JVMTI `GetLoadedClasses()` are suppose to defend against an excess be allocated.

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

PR: https://git.openjdk.org/jdk/pull/11083


More information about the serviceability-dev mailing list