RFR: 8181571: printing to CUPS fails on mac sandbox app [v6]

Phil Race prr at openjdk.java.net
Mon Mar 28 15:19:46 UTC 2022


On Mon, 28 Mar 2022 09:45:11 GMT, Alexander Scherbatiy <alexsch at openjdk.org> wrote:

>> 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.

I should have said (as I did in the beginning) remove the clear - and the new throw - and just return null.

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

PR: https://git.openjdk.java.net/jdk/pull/4861



More information about the client-libs-dev mailing list