RFR: 8334297: (so) java/nio/channels/SocketChannel/OpenLeak.java should not depend on SecurityManager [v3]
Alan Bateman
alanb at openjdk.org
Fri Jun 14 16:37:21 UTC 2024
On Fri, 14 Jun 2024 15:57:29 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:
>
> Minor cleanup
Looks good, assuming you've tested it on all platforms to ensure it is stable.
test/jdk/java/nio/channels/SocketChannel/OpenLeak.java line 73:
> 71:
> 72: System.out.println("Expecting Connection Refused for " + isa);
> 73: System.out.println("Expecting UnresolvedAddressException for " + sa);
JUnit prints the STARTED/SUCCESSFUL/etc messages to System.err so you probably want the trace messages to go to the same stream.
test/jdk/java/nio/channels/SocketChannel/OpenLeak.java line 79:
> 77: try {
> 78: SocketChannel.open(sa);
> 79: throw new RuntimeException("This should not happen");
fail()
-------------
Marked as reviewed by alanb (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/19723#pullrequestreview-2118788580
PR Review Comment: https://git.openjdk.org/jdk/pull/19723#discussion_r1640069383
PR Review Comment: https://git.openjdk.org/jdk/pull/19723#discussion_r1640064610
More information about the nio-dev
mailing list