RFR: 8181571: printing to CUPS fails on mac sandbox app [v6]
Alexander Scherbatiy
alexsch at openjdk.java.net
Mon Mar 28 09:48:45 UTC 2022
On Fri, 25 Mar 2022 17:31:37 GMT, Phil Race <prr at openjdk.org> wrote:
>> The array creation error handling is implemented in the similar way as it is done in the getMedia() function.
>> The ExceptionClear() has been added to the getMedia() by `8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings`
>> I would prefer to have unified error handling in these methods. If ExceptionClear is not suitable in this place it would be better to recheck JDK-8031001 and update all places accordingly in a separate fix.
>
> I can't agree with the apparent reasoning that "well that thing over there is wrong, so it's ok for me to add something here that's wrong too".
>
> And the getMedia(..) case is different. It doesn't re-create the same exception.
> It wants to create an OOME which is not actually thrown by GetStringUTFChars() since it needs to throw some exception and with an appropriate string reason.
> And the clear there is just prudence since it is creating a new one and can't be 100% sure there isn't one pending.
>
> In your case the JNI spec documents OOME
> https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newobjectarray
>
> So in your case it is pointless. Please just remote the Clear()
ExceptionClear(env) is removed from the `if (nameArray == NULL)` check.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4861
More information about the client-libs-dev
mailing list