Hi Phil,

Please review a print service fix for jdk9

Bug: https://bugs.openjdk.java.net/browse/JDK-8034239
webrev: http://cr.openjdk.java.net/~psadhukhan/8034239/webrev.00/

The issue was lpstat -v was reporting 2 printer service but PrintServiceLookup.lookupPrintServices() list only 1.
#lpstat -v
device for tta_printer: ipp://<internal-printer-ip>/printers/tta_printer <ipp://st-tta-adc-02.us.oracle.com/printers/tta_printer>
device for Xerox-WorkCentre-4250: socket://spb04p12.ru.oracle.com:9100

but lookupPrintServices() listed only "Xerox" printer and not "tta_printer".

It seems "tta_printer" was added using

*lpadmin -p printer-name -E -v device -m ppd *

so it becomes a "Remote Printer" and even though Java sees that printer, it calls getUnsupportedAttributes() on that printer service to see if that printer matches the DocFlavor. In this case, this remote printer does not have any supported doc flavor listed so when getSupportedDocFlavors() is called, it does not see any "document-format-supported" attribute.
Although JDK-8040139 fixed this problem by adding

DocFlavor.SERVICE_FORMATTED.PAGEABLE and DocFlavor.SERVICE_FORMATTED.PRINTABLE

to the supported DocFlavors since as per spec,
as per spec
/https://docs.oracle.com/javase/8/docs/api/index.html?javax/print/PrintService.html//
//it clearly says, /
getSupportedDocFlavors()

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


the returned flavours are not populated to supported DocFlavors called by IPPPrintService.java#getUnsupportedAttributes() -> isDocFlavorSupported() so "supportedDocFlavors" was still false for this case.

I added a fix to populate the PAGEABLE & PRINTABLE docflavor to "supportedDocFlavors" and tested in sqe machine and found it working.

I could not add a regression testcase as it involves adding a "remote printer" using lpadmin command. I would add "noreg-sqe" to the bug.

Regards
Prasanta

Reply via email to