RFR: 8373239: Test java/awt/print/PrinterJob/PageRanges.java fails with incorrect selection of printed pages [v3]

Phil Race prr at openjdk.org
Fri Jan 23 18:43:30 UTC 2026


On Fri, 23 Jan 2026 02:55:52 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> 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();
>>     }
>
> I added one more job to print page range 2-4 
> after 1st job of printing 2-3 and 2nd job of ALL pages which works so it seems just removing PageRanges attribute is enough and it will recreate PageRanges when range of pages is to be printed..
> Let me know if you see any other problem..

Surely it is safer (and harmless) to reset these even if they aren't read today.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29312#discussion_r2722410387


More information about the client-libs-dev mailing list