On Tue, 5 Dec 2023 20:07:56 GMT, Phil Race <p...@openjdk.org> wrote: >> test/jdk/java/awt/print/PrinterJob/PrinterDevice.java line 71: >> >>> 69: if (failed) { >>> 70: throw new RuntimeException("Test failed but no exception >>> propagated."); >>> 71: } >> >> A comment that `pj.print` should not throw exception would suffice, even >> though it's implied by jtreg any way. >> >> This statement is essentially unreachable if `failed` is set to `true`. > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16773#discussion_r1416240089