On Tue, 24 Feb 2026 03:26:32 GMT, Prasanta Sadhukhan <[email protected]> wrote:
>> I looked at the code review #29312 for >> [JDK-8373239](https://bugs.openjdk.org/browse/JDK-8373239)… and wondered >> whether that code should rather ensure `PageRanges.class` attribute is >> present instead of removing it and the range to the default value. >> >> https://github.com/openjdk/jdk/blob/6b576235b84f51e273da44158bfcadbb48f51baa/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java#L1737-L1739 > >> I wonder if this is right ? Surely if the PageRanges is not there any more, >> we should update the JobAttributes to a default range ? This would leave >> whatever stale value is present. > > Since null check is being frowned upon, I have modified > [JDK-8373239](https://bugs.openjdk.org/browse/JDK-8373239) fix to not remove > PageRanges attribute and set it to default value incase native code doesn't > set `isRangeSet` parameter via JNI. > > The default value of PageRanges according to spec > https://docs.oracle.com/en/java/javase/25/docs/api/java.desktop/javax/print/attribute/standard/PageRanges.html > > `In other words, the default value for the PageRanges attribute is always > {{1, Integer.MAX_VALUE}}. ` > > and having Pageable.UNKNOWN_NUMBER_OF_PAGES will cause > IllegalArgumentException > https://github.com/openjdk/jdk/blob/f25d429c8d6d099666aefd698ed14628cce5b1cf/src/java.desktop/share/classes/javax/print/attribute/standard/PageRanges.java#L193-L194 > > > but kept setPageRanges value same as Pageable.UNKNOWN_NUMBER_OF_PAGES to > honour its spec > > https://github.com/openjdk/jdk/blob/f25d429c8d6d099666aefd698ed14628cce5b1cf/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java#L1847-L1858 > > Regarding test, since the problem is reproduced in 1.1 PrintJob by just > selecting "ALL" in print dialog, which is the default selection, [and there > is no need to verify actual print output] and since ScaledImagePrinting test > uses default printdialog settings, it will reproduce the issue and it will > also avoid another new manual printing test So the previous fix basically completely broke 1.1 API printing on Windows ... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29874#discussion_r2869636583
