On Thu, 4 Jul 2024 10:34:24 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
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..

src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java line 375:

> 373:                         printLoop(true, firstPage, lastPage);
> 374:                     } catch (PrinterAbortException pex) {
> 375:                         throw new 
> PrinterAbortException(pex.getMessage());

Why not re-throw the original exception ?

src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java line 756:

> 754:         boolean cancelled = (performingPrinting && userCancelled);
> 755:         if (cancelled) {
> 756:             cancelDoc();

The comments about deadlock refer to isCancelled() but is that not also why 
there was an invokeLater() ?
It is not at all clear to me. Perhaps you can explain how the deadlock would 
occur and why it is not a problem for calling cancelDoc() ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20027#discussion_r1694347933
PR Review Comment: https://git.openjdk.org/jdk/pull/20027#discussion_r1694348907

Reply via email to