[OpenJDK 2D-Dev] [9] RFR: Test closed/javax/print/attribute/Services_getDocFl.java fails with NullpointerException (8040139)

Philip Race philip.race at oracle.com
Thu Dec 10 06:47:08 UTC 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20151209/39adfb00/attachment.html>


More information about the 2d-dev mailing list