On Fri, 29 Aug 2025 09:15:49 GMT, SendaoYan <[email protected]> wrote:

>> Hi all,
>> 
>> I think test javax/print/PrintServiceLookup/CountPrintServices.java should 
>> throw jtreg.SkippedException when there is no lpstat, rather that report 
>> test failure.
>> 
>> Only javax/print/PrintServiceLookup/CountPrintServices.java invokes lpstat 
>> explicitly.
>> 
>> Change has been verified locally, test-fix only, no risk.
>
> SendaoYan has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Remove unnecessary whitespace

Changes requested by aivanov (Reviewer).

test/jdk/javax/print/PrintServiceLookup/CountPrintServices.java line 52:

> 50:     try {
> 51:         proc = Runtime.getRuntime().exec(lpcmd);
> 52:     } catch (java.io.IOException e) {

Why not import `java.io.IOException`?

test/jdk/javax/print/PrintServiceLookup/CountPrintServices.java line 57:

> 55:         }
> 56:     }
> 57:     proc.waitFor();

If `IOException` is thrown, `proc` will be `null` which will produce 
`NullPointerException`.

I think you should re-throw the `IOException` if its message is different from 
the case where you throw `SkippedException`.

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

PR Review: https://git.openjdk.org/jdk/pull/26988#pullrequestreview-3168041878
PR Review Comment: https://git.openjdk.org/jdk/pull/26988#discussion_r2309665100
PR Review Comment: https://git.openjdk.org/jdk/pull/26988#discussion_r2309669316

Reply via email to