RFR: 8373239: Test java/awt/print/PrinterJob/PageRanges.java fails with incorrect selection of printed pages [v3]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Thu Jan 22 01:33:23 UTC 2026
On Wed, 21 Jan 2026 18:32:25 GMT, Phil Race <prr at openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:
>>
>> - Merge master
>> - Merge master
>> - Remove PageRange attribute if range is not set
>> - 8373239: Test java/awt/print/PrinterJob/PageRanges.java fails with incorrect selection of printed pages
>
> src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java line 1737:
>
>> 1735: setPageRange(from, to);
>> 1736: } else {
>> 1737: attributes.remove(PageRanges.class);
>
> I'm a bit surprised you didn't need to still reset the page range ... is something else re-setting it ?
> setPageRange(Pageable.UNKNOWN_NUMBER_OF_PAGES, Pageable.UNKNOWN_NUMBER_OF_PAGES)
Once PageRanges attribute is removed, the From/To Page range is not used
As seen from the code read from native, it checks if pageRange attribute is null or not and then read the range and since we are deleting it, the `pageRangesAttr ` will be null.
protected final int getFromPageAttrib() {
if (attributes != null) {
PageRanges pageRangesAttr =
(PageRanges)attributes.get(PageRanges.class);
if (pageRangesAttr != null) {
int[][] range = pageRangesAttr.getMembers();
return range[0][0];
}
}
return getMinPageAttrib();
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29312#discussion_r2714979573
More information about the client-libs-dev
mailing list