On Fri, 11 Jun 2021 17:06:24 GMT, Anton Litvinov <alitvi...@openjdk.org> wrote:
>> Hello, >> >> Could you please review the following fix for the bug specific to macOS. The >> bug consists in the fact that if the method >> "java.awt.print.Printable.print​(Graphics, PageFormat, int)" throws >> "java.awt.print.PrinterException" or "java.lang.RuntimeException" during the >> call "java.awt.print.PrinterJob.print()", then the exception is caught and >> ignored by JDK and a user cannot learn that printing failed and what caused >> failure of printing, because "PrinterJob.print()" method does not throw >> "PrinterException" or the occurred exception is not reported by JDK through >> the error stream. >> >> ROOT CAUSE OF THE BUG: >> The root cause of the bug is the fact that in the method >> "sun.lwawt.macosx.CPrinterJob.printAndGetPageFormatArea(final Printable, >> final Graphics, final PageFormat, final int)" from the file >> "src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java" the >> exception thrown during execution of the expression >> >> "int pageResult = printable.print(graphics, pageFormat, pageIndex);" >> >> is caught but is not returned to a developer by any mean or is not printed >> out to the error stream. >> >> THE FIX: >> The fix implements propagation of the occurred and caught exception to the >> level of the user's code executing "PrinterJob.print()" method. Propagation >> of the exception by storing it in the instance variable of "CPrinterJob" >> object is implemented, because the engaged code always is executed: >> - on 2 threads (non-EDT thread, EDT thread) in case when >> "PrinterJob.print()" is called by the user on a non-EDT thread; >> - on 3 threads (2 EDT threads, a temporary thread started by JDK to execute >> "CPrinterJob._safePrintLoop(long, long );") when "PrinterJob.print()" is >> called on EDT thread. >> >> The regression test which is part of the fix was also successfully executed >> on MS Windows OS and Linux OS. >> >> Thank you, >> Anton > > Anton Litvinov has updated the pull request incrementally with one additional > commit since the last revision: > > Third version of the fix Hello Phil. Thank you for approval of the fix. The new bug about the discovered propagation of the RTE on Windows OS and Linux OS is created, it is (https://bugs.openjdk.java.net/browse/JDK-8268675). Thank you, Anton ________________________________________ From: prrace ***@***.***> Sent: 11 June 2021 20:47 To: openjdk/jdk Cc: Anton Litvinov; Mention Subject: [External] : Re: [openjdk/jdk] 8262731: [macOS] Exception from "Printable.print" is swallowed during "PrinterJob.print" (#4036) @prrace approved this pull request. Ok. Please file a bug as you mention to bring the other platforms into line. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/4036*pullrequestreview-682168475__;Iw!!GqivPVa7Brio!O44TB5FBjFmxmBOMWJaShp0YE2GnSsoKioCVpjjeiWAFttaxMCzjTqiQ8X7BFHWNytY$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AQY7S7FDBITH5EYGP42RUTLTSJR5XANCNFSM44443KWA__;!!GqivPVa7Brio!O44TB5FBjFmxmBOMWJaShp0YE2GnSsoKioCVpjjeiWAFttaxMCzjTqiQ8X7BFC_1zPk$>. ------------- PR: https://git.openjdk.java.net/jdk/pull/4036