RFR: 8264824: java/net/Inet6Address/B6206527.java doesn't close ServerSocket properly [v2]
Conor Cleary
ccleary at openjdk.java.net
Tue Apr 13 10:30:18 UTC 2021
> ### 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.
Conor Cleary has updated the pull request incrementally with one additional commit since the last revision:
Removed othervm argument
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/3437/files
- new: https://git.openjdk.java.net/jdk/pull/3437/files/2cbd69a6..42312d1b
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3437&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3437&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/3437.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3437/head:pull/3437
PR: https://git.openjdk.java.net/jdk/pull/3437
More information about the net-dev
mailing list