On Thu, 25 Sep 2025 11:23:18 GMT, Ravi-Patel8 <[email protected]> wrote:
>> Bug Ref: https://bugs.openjdk.org/browse/JDK-8368606 >> >> As part of [JDK-8344057](https://bugs.openjdk.org/browse/JDK-8344057) >> ("Remove doPrivileged calls from unix platform sources in the java.desktop >> module"), changes were made to execCmd() in >> `src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java`. >> In the updated implementation, execCmd(...) code is missing to initialize >> the results variable. It declares it as null and then tries to >> results.add(line), which prevents the results list from being populated with >> printer names. >> >> Initializing the results variable will resolve the issue. >> >> >> Signed-off-by: Ravi.Patel8 <[email protected]> > > Ravi-Patel8 has updated the pull request incrementally with two additional > commits since the last revision: > > - Updated Comments > > Signed-off-by: Ravi.Patel8 <[email protected]> > - Add catch block to log exception details for troubleshooting printer > command > > Signed-off-by: Ravi.Patel8 <[email protected]> src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java line 879: > 877: bufferedReader = new BufferedReader(reader); > 878: String line; > 879: results = new ArrayList<>(); I'm surprised there's no NPE propagated. It looks like this line was in the middle of a huge re-indented block so it wasn't easy to spot it was removed, which can only have been an editing accident. Looks OK to me but @honkar-jdk please take a look too.. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27482#discussion_r2383467000
