On Tue, 5 Dec 2023 20:32:49 GMT, Phil Race <p...@openjdk.org> wrote:

>> 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

Nope, I checked that it's the real exception. Yet I used a recent version of 
JDK 17 where [JDK-8262731](https://bugs.openjdk.org/browse/JDK-8262731) was 
fixed, it's present in 17.0.1.

Indeed, the test passes with GA version of JDK 17 without the `failed` field.

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

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

Reply via email to