-
Bug
-
Resolution: Unresolved
-
P3
-
8, 11, 16, 17, 18
-
linux, windows
FULL PRODUCT VERSION :
JDK 17+19, JDK 8u291 b10, JDK 8 b132
ADDITIONAL OS VERSION INFORMATION :
MS Windows 10 OS, Cent OS Linux 8 OS
A DESCRIPTION OF THE PROBLEM :
If during the call "java.awt.print.PrinterJob.print()" the method "java.awt.print.Printable.print​(Graphics, PageFormat, int)" throws "java.lang.RuntimeException", then this "RuntimeException" is propagated as is through "PrinterJob.print()" method. By Java SE Specification "PrinterJob.print()" can throw only "java.awt.print.PrinterException", therefore such "RuntimeException" should be a cause of a properly handled "PrinterException".
The bug was discovered during the review of the fix for the bugJDK-8262731, where it was decided that the described behavior of JDK is incorrect. The bug does not affect JDK for macOS, because part of the fix JDK-8262731 addresses it.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run the test case "ExceptionFromPrintableIsIgnored.java" attached to the bugJDK-8262731.
2. In the shown window of the test case select "java.lang.RuntimeException" radio button and select on which thread the method "java.awt.print.PrinterJob.print" should be executed.
3. Click "Run Test" button.
The bug is reproduced, if "RuntimeException" rather than "PrinterException" is displayed in the text area "Test Results:".
JDK 17+19, JDK 8u291 b10, JDK 8 b132
ADDITIONAL OS VERSION INFORMATION :
MS Windows 10 OS, Cent OS Linux 8 OS
A DESCRIPTION OF THE PROBLEM :
If during the call "java.awt.print.PrinterJob.print()" the method "java.awt.print.Printable.print​(Graphics, PageFormat, int)" throws "java.lang.RuntimeException", then this "RuntimeException" is propagated as is through "PrinterJob.print()" method. By Java SE Specification "PrinterJob.print()" can throw only "java.awt.print.PrinterException", therefore such "RuntimeException" should be a cause of a properly handled "PrinterException".
The bug was discovered during the review of the fix for the bug
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run the test case "ExceptionFromPrintableIsIgnored.java" attached to the bug
2. In the shown window of the test case select "java.lang.RuntimeException" radio button and select on which thread the method "java.awt.print.PrinterJob.print" should be executed.
3. Click "Run Test" button.
The bug is reproduced, if "RuntimeException" rather than "PrinterException" is displayed in the text area "Test Results:".
- relates to
-
JDK-8262731 [macOS] Exception from "Printable.print" is swallowed during "PrinterJob.print"
- Resolved