<AWT Dev> RFR: 8262731: [macOS] Exception from "Printable.print" is swallowed during "PrinterJob.print" [v2]

Anton Litvinov alitvinov at openjdk.java.net
Fri May 21 20:16:43 UTC 2021

On Wed, 19 May 2021 15:23:48 GMT, Phil Race <prr at openjdk.org> wrote:

>> Anton Litvinov has updated the pull request incrementally with one additional commit since the last revision:
>>   Second version of the fix
> src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java line 400:
>> 398:                     throw (PrinterException) lastPrintEx;
>> 399:                 } else if (lastPrintEx instanceof RuntimeException) {
>> 400:                     throw (RuntimeException) lastPrintEx;
> I don't see you testing this case 
> And do I understand correctly that this only throws the exception at the end of the printloop after trying all pages ?

In the 2nd version of the fix I added testing of the scenario with "RuntimeException".

Yes, this code is executed only after the execution of the "printLoop" is fully finished for each of all page ranges. If printing of one page fails within one page range, then printing of other pages does not occur. "CPrinterJob.print(PrintRequestAttributeSet)" is blocking until printing is finished or fails, and my code is executed in the very end of the method.


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

More information about the awt-dev mailing list