On Fri, 9 Jan 2026 06:43:50 GMT, Daniel Jeliński <[email protected]> wrote:

>> I think we might still need that. Cleanup will indeed execute either way, 
>> but the purpose of the ExceptionCheck() is not to ensure cleanup, it is to 
>> prevent further native logic from executing while a JNI exception is pending.
>> 
>> The copy-back helpers perform JNI operations that may raise exceptions 
>> independently of the PKCS#11 return value.
>
> Well after c0eba3064f61bc8a19122f52aa491f00c6884092 there's no further native 
> logic after this call, so there's nothing to prevent. The copy-back helpers 
> are only invoked after a successful PKCS11 call now.

Yes. However, the purpose of the ExceptionCheck is not to bypass code but to 
clearly establish that copy-back helpers may raise JNI exceptions independently 
of PKCS11 success, and that from that point onward we must avoid further JNI 
interaction except controlled cleanup and return.

Keeping the explicit ExceptionCheck also serves as a defensive guard for future 
maintenance: if additional logic is ever added before the cleanup label.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29054#discussion_r2677793857

Reply via email to