RFR: 8259343: [macOS] Update JNI error handling in Cocoa code.
Sergey Bylokhov
serb at openjdk.java.net
Mon Jan 11 06:07:57 UTC 2021
On Wed, 6 Jan 2021 21:14:06 GMT, Phil Race <prr at openjdk.org> wrote:
> Proposed updates to JNI error handling.
src/java.desktop/macosx/native/libosxapp/JNIUtilities.h line 41:
> 39: NSLog(@"%@",[NSThread callStackSymbols]); \
> 40: if ([NSThread isMainThread] == NO) { \
> 41: if ((*env)->ExceptionOccurred(env) == NULL) { \
Not sure that the check for ExceptionOccurred is needed, in all other places where we check the ref to methods/field we only check the return value, and if it is null then return immediately assuming that an exception is rased already, for example :
https://github.com/openjdk/jdk/blob/b72de3c5fc99f365e9fb25114ddd28eceddfa6e8/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp#L357
Note that the exception in the static initializer is fatal for the application.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1967
More information about the build-dev
mailing list