RFR: 8326568: jdk/test/com/sun/net/httpserver/bugs/B6431193.java should use try-with-resource and try-finally [v2]
Daniel Fuchs
dfuchs at openjdk.org
Tue Apr 2 13:30:12 UTC 2024
On Tue, 2 Apr 2024 11:55:12 GMT, Darragh Clarke <dclarke at openjdk.org> wrote:
>> Currently this test occasionally doesn't cleanup between runs, sometimes not stopping the server or leaving Streams open
>>
>> Changes:
>> - Use try-with-resources to ensure streams close.
>> - Use try-finally to make sure the server stops before the test exits.
>>
>> I ran tiers 1-3 and ran this specific test on repeat and everything seems stable after the changes
>
> Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision:
>
> implemented feedback
Changes requested by dfuchs (Reviewer).
test/jdk/com/sun/net/httpserver/bugs/B6431193.java line 67:
> 65: server.setExecutor(null);
> 66: // creates a default executor
> 67: server.start();
server.start() (and what preceeds) should be called before entering the try block
test/jdk/com/sun/net/httpserver/bugs/B6431193.java line 77:
> 75: InputStream is = url.openConnection(Proxy.NO_PROXY).getInputStream();
> 76: is.readAllBytes();
> 77: is.close();
you should use try-with-resource here
-------------
PR Review: https://git.openjdk.org/jdk/pull/18514#pullrequestreview-1973805927
PR Review Comment: https://git.openjdk.org/jdk/pull/18514#discussion_r1547878491
PR Review Comment: https://git.openjdk.org/jdk/pull/18514#discussion_r1547882135
More information about the net-dev
mailing list