Integrated: 8264824: java/net/Inet6Address/B6206527.java doesn't close ServerSocket properly
Conor Cleary
ccleary at openjdk.java.net
Thu Apr 15 14:09:36 UTC 2021
On Mon, 12 Apr 2021 15:21:05 GMT, Conor Cleary <ccleary at openjdk.org> wrote:
> ### Description
> `Inet6Address/B6206527.java` test creates two instances of ServerSocket, both of which are explicity bound to a Link-Local address. Neither of the ServerSocket instances are explicitly closed meaning there is no guarantee that their associated resources are freed.
>
> ### Fix
> Each ServerSocket is instantiated in a try-with-resources block. This ensures that in both cases of success or failure within the try-with-resources block, the sockets are always closed thanks to ServerSocket implementing Closeable. The test is also now started in othervm mode as an added assurance of the test's isolation in the event that resources are not freed.
This pull request has now been integrated.
Changeset: 6293299d
Author: Conor Cleary <ccleary at openjdk.org>
Committer: Aleksei Efimov <aefimov at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/6293299d
Stats: 11 lines in 1 file changed: 2 ins; 0 del; 9 mod
8264824: java/net/Inet6Address/B6206527.java doesn't close ServerSocket properly
Reviewed-by: aefimov, dfuchs, michaelm, vtewari
-------------
PR: https://git.openjdk.java.net/jdk/pull/3437
More information about the net-dev
mailing list