[OpenJDK 2D-Dev] RFR: Fix for 8032693 : javax.print.PrintService does not find any CUPS-Printers on Linux
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Fri Feb 7 20:51:12 UTC 2014
On 08.02.2014 0:35, Phil Race wrote:
>> 42 if (!os.equals("linux")) {
>> 43 System.out.println("Linux specific test. No need to
>> continue");
>> 44 }
>> No need to continue... and continue anyway?
>
> Oops. Meant to have a return there :)
>
> I'll fix before I push. Anything else ?
No. The fix looks good.
>
> -phil.
>
>>
>> On 07.02.2014 2:31, 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
>>>
>>
>>
>
--
Best regards, Sergey.
More information about the 2d-dev
mailing list