[OpenJDK 2D-Dev]  RFR: JDK-8066139, , Null return from PrintJob.getGraphics() running closed/java/awt/PrintJob/HighResTest/HighResTest.java
philip.race at oracle.com
Fri Feb 19 20:25:52 UTC 2016
I am having trouble building JDK 9 at the moment so i applied 8061267 to
and was able to reproduce the regression and have a couple of observations
- I am now seeing the NPE after the first page as you did .. puzzling.
- I next applied your fix but still see the NPE !
It appears that all your fix did is stop the "PD_PAGENUMS" flag being
set. If I manually select it, (ie select that "Pages" radio button) then
then voila, the NPE is back!
On 02/19/2016 10:53 AM, Phil Race wrote:
> I am not sure I can be correctly understanding the fix as the
> ramification seems
> to be that if the users wants to print only Page 3 of a 10 page
> document and so sets
> from page=3 and to page=3, that this request will be ignored and all
> pages will
> be printed .. can you test such a scenario.
> Additionally, have you tried running the original test case provided
> with 8061267
> against your fix ?
> Also when I ran the HighResTest on a current build I saw a null
> graphics on
> the very first call to getGraphics() which is different than what I
> you as saying - you see the null *after* the first page is printed.
> On 02/19/2016 01:18 AM, prasanta sadhukhan wrote:
>> Hi Phil, All,
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8066139
>> webrev: http://cr.openjdk.java.net/~psadhukhan/8066139/webrev.00/
>> It was seen after fix of JDK-8061267
>> <https://bugs.openjdk.java.net/browse/JDK-8061267>: PrinterJob:
>> Specified Page Ranges not displayed in Windows Native Print Dialog
>> the closed/java/awt/PrintJob/HighResTest/HighResTest.java was failing
>> with NPE when PrinterJob.getGraphics() is called the 2nd time before
>> calling PrinterJob.end().
>> The above fix caused this regression because it sets the PD_PAGENUMS
>> flag for windows PrintDlg struct which causes *Pages* radio button to
>> be selected in print dialog.
>> However, fromPage and toPage was both set to 1 so after the 1st page
>> is printed, RasterPrinterJob.print(attributes) finishes and
>> graphicsToBeDrawn.closeWhenEmpty() gets called
>> which sets the queue to null so when PrinterJob2D#getGraphics() calls
>> graphicsToBeDrawn.pop() it sees queue to be null and sets graphics
>> object to be null so
>> PrinterJob.getGraphics() gets null and g.drawLine in testcase causes
>> NPE since g is null.
>> Fix was done to set the PD_PAGENUMS flag only when toPage is more
>> than fromPage in which case, "All" will be selected in printer dialog
>> and RasterPrinterJob.print() will finish only after printing all the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the 2d-dev