<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 13:05:27 UTC 2021

On Sun, 30 May 2021 18:09:36 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 124:
>> 122:             }
>> 123:             throw new RuntimeException("Unexpected exception was thrown.");
>> 124:         } else {
> When running on the EDT do you really want to do this ?

Yes, I do really want to do this, when running on EDT, the whole test relies on this approach. When the test is run on EDT this is done via "SwingUtilities.invokeAndWait" method in the constructor of the test "ExceptionFromPrintableIsIgnoredTest" and in that constructor there is "try/catch" block. If some exception occurs on EDT and is not caught on EDT, then it will be wrapped by JDK in "InvocationTargetException" instance which will be thrown from "SwingUtilities.invokeAndWait" method and will be caught by that "try/catch" block in the constructor of the test. I checked that this code works before sending the code for review and today additionally.


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

More information about the awt-dev mailing list