[OpenJDK 2D-Dev] [9]: RFR JDK-6357905, , java.awt.JobAttributes.getFromPage() and getToPage() always returns "1".

prasanta sadhukhan prasanta.sadhukhan at oracle.com
Tue Mar 29 05:35:21 UTC 2016

Hi Phil,

On 3/29/2016 6:45 AM, Philip Race wrote:
> Please add an evaluation to the bug report.
> As to the fix I am under the impression that min&max page are
> meant to constrain what the user can enter in the dialog so
> if min page & max page are set to "1" then the problem
> may be with those settings ?
min Page is set to 1, max page is set to Integer.MAX_VALUE which I guess 
is right so am not sure what to change in those settings.
In PrintJob2D.java#initPrintJob2D(), it sets the page ranges and to and 
from page and in setPageRanges()
it throws an IAE if firstPage < minPage.
We can also do the same instead of updating the min Page so to force the 
user to update the min Page first before updating the page ranges.
we can transparently change the min page (without resetting back to 
initial minpage after setting the to/from page as I was doing in my fix) 
to from page when user sets the page ranges.
Your thoughts?

> i.e the application can set those values and expect the user
> can't change them so updating our code to circumvent that
> seems wrong.
> -phil.
> On 3/28/16, 1:38 AM, prasanta sadhukhan wrote:
>> Hi All,
>> Please review a print job attribute fix for jdk9.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-6357905
>> webrev: http://cr.openjdk.java.net/~psadhukhan/6357905/webrev.00/
>> The issue was in the Print-dialog, when some pages are specified 
>> using "Pages" within "Page range", 
>> java.awt.JobAttributes.getFromPage() and getToPage() always returns "1"
>> and not the values as updated by the user.
>> The fix was to get the pageranges attribute as set by the user and 
>> obtain the from and to Page range and update the JobAttribute's from 
>> and to Page.
>> Regards
>> Prasanta

More information about the 2d-dev mailing list