RFR: 8378417: Printing All pages results in NPE for 1.1 PrintJob [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Feb 24 03:32:41 UTC 2026


> After [JDK-8373239](https://bugs.openjdk.org/browse/JDK-8373239):, Printing ALL pages results in NPE for 1.1 PrintJob because of lack of set pageranges citing
> 
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "javax.print.attribute.standard.PageRanges.getMembers()" because "range" is null
>         at java.desktop/sun.print.PrintJobDelegate.updateAttributes(PrintJobDelegate.java:529)
>         at java.desktop/sun.print.PrintJobDelegate.printDialog(PrintJobDelegate.java:424)
>         at java.desktop/sun.print.PrintJob2D.printDialog(PrintJob2D.java:65)
>         at java.desktop/sun.awt.windows.WToolkit.getPrintJob(WToolkit.java:644)
>         at java.desktop/sun.awt.windows.WToolkit.getPrintJob(WToolkit.java:629) 
> 
> A null check is now added as we are now removing PageRange attribute if not set..It works fine for PrinterJob but fails for 1.1 PrintJob as PrintJobDelegate.updateAttributes called in 1.1 PrintJob use pageRange variable without checking if it exists.

Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:

  Set default value for PageRange

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/29874/files
  - new: https://git.openjdk.org/jdk/pull/29874/files/f19e7c15..de297002

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29874&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29874&range=00-01

  Stats: 9 lines in 3 files changed: 2 ins; 2 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/29874.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29874/head:pull/29874

PR: https://git.openjdk.org/jdk/pull/29874


More information about the client-libs-dev mailing list