[OpenJDK 2D-Dev] RFR: Fix for 8032693 : javax.print.PrintService does not find any CUPS-Printers on Linux

Jennifer Godinez jennifer.godinez at oracle.com
Fri Feb 7 17:00:34 UTC 2014


On 02/06/2014 02:31 PM, Phil Race wrote:
> http://cr.openjdk.java.net/~prr/8032693/
> This is a fix for https://bugs.openjdk.java.net/browse/JDK-8032693
> It was introduced by the JDK 8 b115 fix for 
> https://bugs.openjdk.java.net/browse/JDK-8022536
> The root of the issue is that if you do not have a default printer set 
> in CUPS then
> we get an NPE at line 635 (original file) of 
> UnixPrintServiceLookup.java de-referencing
> the array  returned from CUPSPrinter.getDefaultPrinter().
> This caused a failure not just locating the default but *any* printer 
> because
> the NPE went all the way back up to javax.print implementation where 
> it calls
> getPrintServices()
> Really preventing that NPE from happening is all there is to the fix
> But for good measure I
> 1) Catch such an exception inside refreshServices() so we can continue on
> 2) Fix the usage of device-uri (should be printer-uri-supported)
> 3) Add lots more debugging to make it easier to get to the bottom of 
> future problems.
> I'm pretty confident in this fix since I was able to reproduce the 
> problem
> by updating CUPS so I had no default and this cures it.
> I've added a regression test as best I can. Unless you have printers, but
> have also no default printer its going to pass regardless.
> -phil

More information about the 2d-dev mailing list