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

Phil Race philip.race at oracle.com
Fri Feb 7 20:35:01 UTC 2014


On 2/7/2014 12:21 PM, Sergey Bylokhov wrote:
> Hi , Phil.
> Why we catch Throwable(OutOfMemoryError)? 

Because I want to be as sure as I can be that we don't get
some random error causing us to fail completely as was happening.

> Probably we can use java generics in defaultMap in CUPSPrinter?

This fix isn't intended as clean-up as I want to directly backport to 8
So aside from fixing the big and very real problem and adding debugging help
I don't want to do anything else here.
In fact I chopped out a bunch of other clean up I have pending.
It'll go in another fix, another day.

>
> Code from the test:
>   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 ?

-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
>>
>
>




More information about the 2d-dev mailing list