[OpenJDK 2D-Dev] [9] RFR: JDK-8039412, , Stack overflow on Linux using DialogTypeSelection.NATIVE

prasanta sadhukhan prasanta.sadhukhan at oracle.com
Fri Nov 13 08:24:33 UTC 2015

Hi Phil,

On 11/13/2015 12:23 AM, Philip Race wrote:
> I am 99% sure this breaks the API on Windows on Mac.
> Did you test what it does there ?
It works on Windows as PrinterJob.pageDialog(attributes) calls 
pageDialog(PageFormat page) in WPrinterJob.java which overrides 
pageDialog(PageFormat) of RasterPrinterJob
It also works on Mac as PrinterJob.pageDialog(attributes) calls 
pageDialog(PageFormat page) in CPrinterJob.java which overrides 
pageDialog(PageFormat) of RasterPrinterJob

I actually mistakenly mentioned down below that the check was added in 
pageDialog(attributes) whereas actually
the temporary removal and addition was added in pageDialog(PageFormat) 
so it only affects linux printing dialog.
> Test has wild card imports again ..
Corrected wild card imports. Updated webrev is here:

> Also please add evaluation and explanation of the proposed fix into a
> public comment on the bug report before submitting for review.
Added public comment.

> -phil.
> On 11/6/15, 3:00 AM, prasanta sadhukhan wrote:
>> Hi All,
>> Please review a fix for jdk9.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8039412
>> webrev: http://cr.openjdk.java.net/~psadhukhan/8039412/webrev.00/
>> Issue was seen in linux whereby if we call PrinterJob.pageDialog() 
>> after PrinterJob.printDialog() it results in StackOverflowError if 
>> DialogSelectionType is NATIVE.
>> This was because pageDialog(attributes) was calling 
>> pageDialog(pageformat) if it is DialogTypeSelection.NATIVE which 
>> again calls pageDialog(attributes)
>> via this code
>> http://hg.openjdk.java.net/jdk9/client/jdk/file/298d3fe64572/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java#l767 
>> and
>> http://hg.openjdk.java.net/jdk9/client/jdk/file/298d3fe64572/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java#l743 
>> I added a fix whereby in pageDialog(attributes)we check if it is 
>> DialogTypeSelection.NATIVE and remove this attribute temporarily 
>> before calling pageDialog(pageformat)
>> and restore the DialogTypeSelection.NATIVE after the call.
>> It is similar to solution done in
>> http://hg.openjdk.java.net/jdk9/client/jdk/file/298d3fe64572/src/java.desktop/share/classes/sun/print/PSPrinterJob.java#l443 
>> Regards
>> Prasanta

More information about the 2d-dev mailing list