RFR: 8259343: [macOS] Update JNI error handling in Cocoa code. [v3]
Phil Race
prr at openjdk.java.net
Tue Jan 12 17:28:58 UTC 2021
On Tue, 12 Jan 2021 02:38:11 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>>> Not sure that the check for ExceptionOccurred is needed,
>> It may not be needed in practice but if the code path is never taken no harm ...
>>
>> 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.
>>
>> Nothing new here.
>
> The new thing here is that you check the result of the ExceptionOccurred if NULL is returned from the GetMethodID/etc, we usually never do it. If such checks are necessary then I'll create a separate bug to update other similar use cases.
Here I don't have immediate control over why this is being called.
So we could have null but no pending exception depending on what the caller did.
It won't be executed except in the rare case there's a problem so it certainly isn't causing overhead so what is the problem ?
I don't see a need to change other code unless there's a really good reason.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1967
More information about the build-dev
mailing list