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

Anton Litvinov alitvinov at openjdk.java.net
Mon May 31 12:35:23 UTC 2021


On Sun, 30 May 2021 18:08:38 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
>
> test/jdk/java/awt/print/PrinterJob/ExceptionFromPrintableIsIgnoredTest.java line 85:
> 
>> 83:         PrinterJob job = PrinterJob.getPrinterJob();
>> 84:         if (job.getPrintService() == null) {
>> 85:             throw new RuntimeException("No printers are available.");
> 
> where does this exception go if it happens and you are on EDT ?

If this exception happens on EDT, this exception as any other exception thrown from the method "runTest" will be perfectly caught and handled in "catch" block of the constructor of the test "ExceptionFromPrintableIsIgnoredTest" as "InvocationTargetException" instance, which will have this "RuntimeException" as its cause. The whole test relies on this approach of throwing and catching the exception and it works.

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

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


More information about the awt-dev mailing list