RFR: JDK-8344057 : Remove doPrivileged calls from unix platform sources in the java.desktop module [v3]

Phil Race prr at openjdk.org
Wed Nov 20 19:31:29 UTC 2024


On Tue, 19 Nov 2024 19:43:22 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java line 914:
>> 
>>> 912:             }
>>> 913:         } catch (IOException io) {
>>> 914:             io.printStackTrace();
>> 
>> Review required. In the original code IOException was being thrown here - 
>> 
>> 
>> AccessController.doPrivileged(
>>                 new PrivilegedExceptionAction<ArrayList<String>>() {
>>                     public ArrayList<String> run() throws IOException
>> 
>> Now that the doPrevileged calls is removed, Do we catch the IOException & print stacktrace OR propagate it?
>> If the IOException is propagated then IOException needs to be thrown by execCmd() method and methods that in-turn call execCmd().
>> 
>> getPrinterIsAcceptingJobsBSD() 
>> getPrinterIsAcceptingJobsAIX()
>> getQueuedJobCountBSD()
>> getQueuedJobCountAIX()
>
> @prrace Can you please advice on this particular code changes - Is it okay to catch IOException here or propagate it ?

The existing code caught it and did not propagate it.
So it should be caught and not propagated - and do not add the printStackTrace.
remove it.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22218#discussion_r1850870166


More information about the client-libs-dev mailing list