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