RFR: 8334297: (so) java/nio/channels/SocketChannel/OpenLeak.java should not depend on SecurityManager [v5]
Alan Bateman
alanb at openjdk.org
Tue Jun 18 07:05:11 UTC 2024
On Mon, 17 Jun 2024 18:36:53 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> The test java/nio/channels/SocketChannel/OpenLeak.java depends on the SecurityManager to trigger an exception in SocketChannel::connect.
>>
>> This change rewrites it to connect to a TCP reserved port instead, such as port 47, 51, or 61, in order to trigger a `ConnectException` instead of a `SecurityException`.
>>
>> The original issue that this test tried to check for was:
>> https://bugs.openjdk.org/browse/JDK-6548464
>
> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
>
> Refactor to ParameterizedTest. Do not test for refused connection on Windows Server 2016
test/jdk/java/nio/channels/SocketChannel/OpenLeak.java line 109:
> 107: cases.add(new Object[]{sa, UnresolvedAddressException.class});
> 108: cases.add(new Object[]{isa, ConnectException.class});
> 109: return cases;
A somewhat subjective comment but I don't think I would add the SocketAddress to the list of test cases when its value is null. So if there isn't a suitable port then it would just reduce the set of test cases.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19723#discussion_r1643933538
More information about the nio-dev
mailing list