Thanks Phil for your approval.
I have opened up the closed test also. Here's the updated webrev:
http://cr.openjdk.java.net/~jdv/prasanta/8040139/webrev.01/

Sergey, would be able to +1 this?

Also, in addition to what Phil mentioned that it is expensive to enumerate for available printers in the network, we simply go for this fix to return an array with one entry in DocFlavor if the printer(s) already registered/added are not available and when user goes to print through the dialog, they would see the printer is "stopped" or "unable to connect" instead of a NPE.

Regards
Prasanta
On 12/10/2015 12:17 PM, Philip Race wrote:
I had to hunt for this since you did not include the bug number in the subject line. The fix is fine although you really should explain to people why this approach is taken rather than ignoring the printer. i.e it is prohibitively expensive to use
"lpstat -p" when simply enumerating available printers.

And I think the closed test can be opened. I don't see any problem with it and
it was developed internally.

-phil.


On 12/2/15, 2:35 AM, prasanta sadhukhan wrote:
Hi All,

Please review a fix for jdk9
Bug: https://bugs.openjdk.java.net/browse/JDK-8040139
webrev: http://cr.openjdk.java.net/~jdv/prasanta/8040139/webrev.00/

It seems if a IPP printer is not accessible, PrintServiceLookup.lookupPrintServices will return the printer service but PrintService.getSupportedDocFlavors() will return null since for the printer there is no way to answer the questions as to what it supports and if after that someone tries to access flavors.length it will cause NPE.
However, as per spec
/https://docs.oracle.com/javase/8/docs/api/index.html?javax/print/PrintService.html//
//it clearly says, //
/

/Returns:/
    /Array of supported doc flavors, should have at least one element./


so returning null is a violation of spec.
I have added a fix to return DocService.SERVICE_FORMATTED flavor for such case.

Could not add a reg testcase as it will need an inaccessible printer.

Regards
Prasanta

Reply via email to