On Thu, 1 Aug 2024 05:12:51 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> When a printjob is cancelled midway, `PrinterAbortException `was not thrown
>> in macos. because
>> firstly,` cancelCheck` invokes` LWCToolkit.invokeLater` with null as
>> parameter causing it to fail with NPE and
>> secondly PrinterAbortException was consumed silently when `printLoop` throws
>> any exception
>> which is rectified to throw the PrinterAbortException when encountered..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Restore invokeLater and throw PrinterAbortException from native
src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java line 764:
> 762: }
> 763: }}, null);
> 764: } catch (NullPointerException ex) {
I'm confused. I thought you were going to do something about the null ?
Unless you don't this code won't work.
Restoring using invokeLater isn't the same thing as restoring the bug.
Look at the code that you are calling - it won't run the Runnable if there's an
NPE.
"new Component()" instead of null for example.
FWIW I do not understand why this code uses LWCToolkit.invokeLater()
Seems unnecessary.
Why don't it use EventQueue.invokeLater() directly ?
That'll solve a couple of problems - simpler code, no null check because no
Component arg needed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20027#discussion_r1700633061