[OpenJDK 2D-Dev] RFR: 8225007: java/awt/print/PrinterJob/LandscapeStackOverflow.java may hang

Philip Race philip.race at oracle.com
Thu May 30 01:06:07 UTC 2019

On 5/29/19, 4:05 PM, Sergey Bylokhov wrote:
> On 29/05/2019 15:42, Phil Race wrote:
>> For example windows some times pops up a dialog prompting you to 
>> install a printer.
> But in this case we should not even try to print something, since we 
> checked at the beginning that there are no printers.

This test does not check. Nor does (IIRC) the implementation,
because you want an experience like what you would get if you
tried to print from notepad, word, IE, whatever.
Which was to prompt you to install a printer if there is none.
That was the idea "back in the day" and is what happened on XP for sure.

> I decided to check by eyes what happens on the system:
>  - The system has a few printers, and default one is "print to pdf".

None of them are "real" printers, but the experience after you try to 
print depends
on whether these "virtual" printers exist or have been removed or ...

>  - When the test is executed the printer promts the location to where 
> store the pdf file(probably this location can be set to some default 
> and we will able to test printing as well at someday)

Even on a system with physical printers configured, if a pdf printer is 
the default
you could get prompted, but there is no API that I know of that can tell 
you this.

> BTW this windows system was soooo slow so I was not able to move the 
> mouse to select the file location, and have to reboot it....
>> -Phil.
>>> On May 29, 2019, at 3:40 PM, Phil Race <philip.race at oracle.com> wrote:
>>> If you try to print when there is no printer the behavior is not 
>>> strictly specified.
>>> -Phil.
>>>>> On May 29, 2019, at 3:25 PM, Sergey Bylokhov 
>>>>> <Sergey.Bylokhov at oracle.com> wrote:
>>>>> On 29/05/2019 15:16, Philip Race wrote:
>>>>> It doesn't hang there. It hangs in print().
>>>> I guess it is even more strange, it hangs when tries to print to 
>>>> non-existent printer. I guess in this case the "new 
>>>> PrinterException("No print service found.")" should be thrown. It 
>>>> looks like a bug, no?
>>>>> -phil.
>>>>>>> On 5/29/19, 3:17 PM, Sergey Bylokhov wrote:
>>>>>>> On 29/05/2019 14:09, Phil Race wrote:
>>>>>>> think the mystery is not why it times out now, but why it did 
>>>>>>> not do so earlier.
>>>>>> But I assume it if the system does not have the printer then 
>>>>>> PrinterJob.getPrinterJob() should not hang?
>>>>>> It looks like the test correctly assume that .getPrinterJob() 
>>>>>> should returns something even if there are no printers, and also 
>>>>>> tries to catch any exceptions in the print(); I guess its 
>>>>>> expectation are according the specification, isn't?
>>>> -- 
>>>> Best regards, Sergey.

More information about the 2d-dev mailing list