On Wed, 6 Jan 2021 04:29:10 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> Test fails with timeout and it seems likely due to non-availability of 
>> printer in the test system. We should just update the test to check for 
>> default (or available) printers and return if there is no printer.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Fix code

test/jdk/java/awt/print/PrinterJob/LandscapeStackOverflow.java line 46:

> 44: 
> 45:     public static final void main( String[] parameters ) throws Exception 
> {
> 46:         PrintService[] printService = PrinterJob.lookupPrintServices();

As far as I understand and comment in my previouse comment, if the 
lookupPrintServices() return empty array then the "PrinterJob.print()" will 
throw the same PrinterException("No print service found");

And if default printer is not set, and we have some other printers then 
"PrinterJob.print()" will select some non-default printer already, isn't it?

I meant that we just duplicate an existed checks, and both of them wll not 
work. If the system has some non-real printers like XPS, or "print to PDF" then 
such printers will be count  by the "PrinterJob.lookupPrintServices()" so no 
exception will be thrown and the test just hands suggestion the user to save 
the printed document somewhere. The hang occur exactly where it is reported in 
JBS "WPrinterJob._startDoc".

I can reproduce it on the freshly installed Windows.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1927

Reply via email to