[OpenJDK 2D-Dev] [9] RFR: JDK-8154057, , [macosx] getPrintJob doesn't throw NPE if Frame is null AND type is COMMON

Jayathirth D V jayathirth.d.v at oracle.com
Fri Apr 15 05:24:32 UTC 2016

Hi Prasanta,

Changes are fine.
Please add your analysis in JBS. Some lines in test case has more than 80 characters, please update them before pushing.
I have updated the OS and CPU as generic for new bug https://bugs.openjdk.java.net/browse/JDK-8154218 since we know it is common problem among all platforms.

-----Original Message-----
From: prasanta sadhukhan 
Sent: Thursday, April 14, 2016 11:00 AM
To: Philip Race
Cc: 2d-dev at openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] [9] RFR: JDK-8154057, , [macosx] getPrintJob doesn't throw NPE if Frame is null AND type is COMMON

Thanks for the review. I have filed a new issue for this non-usage of frame

On 4/13/2016 9:29 PM, Philip Race wrote:
> Ok, so +1 to this fix but file a new bug to track the non-usage of the 
> owner frame.
> -phil.
> On 4/13/16, 1:13 AM, prasanta sadhukhan wrote:
>> Hi Phil,
>> Yes, it seems code does not use this frame as parent/owner.
>> Actually, xxxToolkit will call initPrintJob2D() after checking for 
>> frame==null, followed by PrintJob2D.printDialog() which will just 
>> store the frame in the attribute if (frame != null) {
>>              attributes.add(new DialogOwner(frame));
>>          }
>> and then call ServiceUI.printDialog() which just pass null as owner 
>> to ServiceDialog() for now.
>> // For now we set owner to null. In the future, it may be passed
>>         // as an argument.
>>         Window owner = null;
>> dialog = new ServiceDialog(gc,
>>                                        x,
>>                                        y,
>>                                        services, defaultIndex,
>>                                        flavor, attributes,
>>                                        (Dialog)owner); and so this 
>> behaviour is common to all platforms.
>> I guess we should populate WIndow owner with this frame object.
>> But since this NPE problem is specific to mac,can we fix this bug 
>> first as the other platforms has same null check code in
>> Toolkit.getPrintJob() and create another bug for this frame usage. 
>> Please let me know your thoughts.
>> BTW,
>> It was not seen (ie NPE is thrown) for native dialog in mac as in
>> initPrintJob2D() we have this check
>> if (frame == null &&
>>             (jobAttributes == null ||
>>              jobAttributes.getDialog() == DialogType.NATIVE)) {
>>             throw new NullPointerException("Frame must not be null");
>>         }
>> Regards
>> Prasanta
>> On 4/12/2016 10:43 PM, Phil Race wrote:
>>> hmm .. if it does not throw NPE when the dialog type is common that 
>>> could mean that the code is not referencing the frame as a modal 
>>> parent /owner in that case which could be another bug.
>>> Did you check into how this is used relative to other platforms ?
>>> -phil.
>>> On 04/12/2016 04:16 AM, prasanta sadhukhan wrote:
>>>> Hi All,
>>>> Please review a fix for jdk9.
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8154057
>>>> webrev: http://cr.openjdk.java.net/~psadhukhan/8154057/webrev.00/
>>>> As per spec, Toolkit.getPrintJob() should throw NPE if null frame 
>>>> object is passed to it.
>>>> But on macos, it seems getPrintJob() does not check for null frame 
>>>> and show the print dialog.
>>>> Fix is to check for null frame which is same as what we do in 
>>>> windows (WToolkit) and linux (XToolkit).
>>>> Regards
>>>> Prasanta

More information about the 2d-dev mailing list