On Tue, 5 Dec 2023 20:25:46 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> On JDK 17 and earlier you will reach this line with this test as written
>> And without that exception, the test would pass when it should fail.
>
> With JDK 17, I still see the exception:
> 
> 
> Exception in thread "main" java.awt.print.PrinterException
>       at java.desktop/sun.lwawt.macosx.CPrinterJob.print(CPrinterJob.java:393)
>       at PrinterDevice.main(PrinterDevice.java:68)
> Caused by: java.lang.NullPointerException: Cannot read field "m00" because 
> "Tx" is null
>       at 
> java.desktop/java.awt.geom.AffineTransform.<init>(AffineTransform.java:490)
>       at 
> java.desktop/sun.print.PrinterGraphicsConfig.getDefaultTransform(PrinterGraphicsConfig.java:105)
>       at PrinterDevice.print(PrinterDevice.java:87)
> 
> 
> Yet it's fine to ensure no exception is swallowed.

That exception you are seeing is from the printStackTrace()
If you were to comment out these lines as shown below
@@ -90,9 +90,9 @@ public int print(Graphics g, PageFormat pf, int pageIndex) {
             AffineTransform gt = g2.getTransform();
             System.out.println("Graphics2D transform = " + gt);
         } catch (Exception e) {
-            failed = true;
-            System.err.println("Unexpected exception getting transform.");
-            e.printStackTrace();
+            //failed = true;
+            //System.err.println("Unexpected exception getting transform.");
+            //e.printStackTrace();
             throw e;

then the test would pass on JDK 17

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16773#discussion_r1416246478

Reply via email to