[OpenJDK 2D-Dev] [9]: RFR JDK-8058316, , lookupDefaultPrintService returns null on Solaris 11

Jayathirth D V jayathirth.d.v at oracle.com
Mon Mar 7 06:18:32 UTC 2016


Fix looks fine. Please add relevant noreg label in bug before resolving it, since there is no test case.

Thanks,
Jay
-----Original Message-----
From: Phil Race 
Sent: Saturday, March 05, 2016 1:00 AM
To: prasanta sadhukhan
Cc: 2d-dev at openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] [9]: RFR JDK-8058316, , lookupDefaultPrintService returns null on Solaris 11

Approved.

-phil.

On 03/04/2016 02:47 AM, prasanta sadhukhan wrote:
> Hi Phil,
>
> Please find the modified webrev
> http://cr.openjdk.java.net/~psadhukhan/8058316/webrev.01/
>
> Regards
> Prasanta
> On 3/4/2016 3:21 AM, Phil Race wrote:
>> I think there is a small memory leak with this code :
>> https://www.cups.org/documentation.php/doc-2.0/api-cups.html#cupsGetD
>> ests
>>
>>
>> "Use the cupsFreeDests function to free the destination list"
>>
>> Also I am not sure if you are using cupsGetDest as intended :-
>>
>>  202     cups_dest_t *dest = j2d_cupsGetDest(NULL, NULL, num_dests, 
>> dests);
>>  203     if (dest != NULL) {
>>  204         for (i = 0; i < num_dests; i++) {
>>  205             if (dest[i].is_default) {
>>  206                 defaultPrinter = dest[i].name;
>>  207                 break;
>>  208             }
>>  209         }
>>  210     }
>>
>>
>> I don't think you are expected to iterate over the result here.
>> I think it is already the pointer to the default. In other words the 
>> function will already have done what your for loop is doing.
>> If there is no default you will iterate off the end ..
>>
>> -phil.
>>
>> On 03/03/2016 02:39 AM, prasanta sadhukhan wrote:
>>> Hi Phil,
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8058316
>>> webrev: http://cr.openjdk.java.net/~psadhukhan/8058316/webrev.00/
>>>
>>> The issue was on some Solaris 11 hosts lookupDefaultPrintService() 
>>> returns null while lpstat -d reports an ipp printer.
>>> The issue was found to exist in linux too since it uses CUPS.
>>>
>>> What was happening was that CUPSPrinter.java#getDefaultPrinter()
>>> searches for server-defined default destination by connection to 
>>> CUPS server but if the user sets the default printer using 
>>> "lpoptions -d <printername>" command, server will not have any 
>>> knowledge of this settings and this user-set default printer (which 
>>> is stored in ~/.cups/lpoptions file) was not searched and 
>>> getDefaultPrinter() returns null since it could not find any server 
>>> default printer.
>>>
>>> Fix is to call cupsGetDest API to search for a lpoptions-defined 
>>> default printer and if not set, then search for server-defined 
>>> destination.
>>>
>>> I could not provide a regression testcase for this as it involves 
>>> setting default printer using lpoptions command.
>>>
>>> Regards
>>> Prasanta
>>>
>>
>




More information about the 2d-dev mailing list