[OpenJDK 2D-Dev] [9] Review Request: 8046007: Java app receives javax.print.PrintException: Printer is not accepting job

Alexey Ivanov alexey.ivanov at oracle.com
Mon Aug 11 09:42:14 UTC 2014


Could anybody please review the fix as the second reviewer?

     bug: https://bugs.openjdk.java.net/browse/JDK-8046007
     webrev: http://cr.openjdk.java.net/~aivanov/8046007/jdk9/webrev.00/

Thank you in advance,

On 23.07.2014 1:44, Phil Race wrote:
> I think this is OK. Perhaps some of these states being deleted ought 
> instead
> to bubble up into a PrinterState of STOPPED and appropriate 
> PrinterStateReasons
> but that's something that can be handled separately.
> -phil.
> On 7/22/14 7:52 AM, Alexey Ivanov wrote:
>> Hi Phil, Jennifer,
>> Could you please review this fix?
>> Thank you in advance,
>> Alexey.
>> On 16.07.2014 17:09, Alexey Ivanov wrote:
>>> Hello,
>>> Please review the fix for jdk9:
>>>     bug: https://bugs.openjdk.java.net/browse/JDK-8046007
>>>     webrev: http://cr.openjdk.java.net/~aivanov/8046007/jdk9/webrev.00/
>>> Problem description:
>>> If printer is an error state for some reason, Java application 
>>> cannot post a new print job to printer queue because of exception:
>>> java.awt.print.PrinterException: Printer is not accepting job.
>>>         at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1326)
>>>         at 
>>> javax.swing.text.JTextComponent$2.call(JTextComponent.java:2320)
>>>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>>>         at 
>>> javax.swing.text.AbstractDocument.render(AbstractDocument.java:420)
>>>         at 
>>> javax.swing.text.JTextComponent$3.run(JTextComponent.java:2369)
>>>         at java.lang.Thread.run(Thread.java:744)
>>> At the same time, regular Windows applications (e.g. Word) can still 
>>> add new print jobs to the queue of this printer.
>>> See also related JDK-6996782: RFE: Optionally allow submitting 
>>> printjobs even if Printer is not accepting job
>>> and JDK-6525150: Printer has "paper out" status and won't print due 
>>> to a PrinterException.
>>> The fix:
>>> Currently Java checks the status of the printer, and does not allow 
>>> posting a new print job if the printer is in an error state. At the 
>>> same time, the print queue functions without any issues. It is 
>>> user's responsibility to fix a problem with the printer, as soon as 
>>> it's resolved, all the print jobs will be processed by the printer.
>>> Microsoft Knowledge Base article 
>>> http://support.microsoft.com/kb/160129 says:
>>> The Printer is assumed ready to accept print jobs … even if the 
>>> physical printer is in an error state such as off-line.
>>> As far as I can see, the only printer state from the list 
>>> (http://msdn.microsoft.com/en-us/library/windows/desktop/dd162845%28v=vs.85%29.aspx) 
>>> that doesn't allow adding new print jobs is 
>>> PRINTER_STATUS_PENDING_DELETION which means "The printer is being 
>>> deleted." Surely one cannot print to a deleted printer.
>>> I tested this fix by disconnecting the network printer. It takes 
>>> some time for printer monitor to update the status before 
>>> communication error is detected. It would not be detected at all 
>>> until you add at least one print job. As soon as the printer driver 
>>> detects the problem and communicates it to Windows, printer queue 
>>> displays an error state on the currently processed print job. From 
>>> that moment, Java apps cannot print to this printer.
>>> With this fix, Java still considers "Accepting jobs" and thus allows 
>>> posting new jobs to the printer queue.
>>> When the connection to the printer is restored, all the queued jobs 
>>> are successfully processed and documents are printed.
>>> Regression test:
>>> I ran regressions tests in jdk/tests/javax/print, and all tests passed.
>>> No regression test is provided due to its complexity. Printer should 
>>> go to an error state, it depends on the printer driver and on 
>>> whether the printer is local or network.
>>> There's a test app and steps to try to reproduce the issue in the 
>>> JBS bug 8046007.
>>> Thank you,
>>> Alexey.

More information about the 2d-dev mailing list