RFR: 8304286: java/net/SocketOption/OptionsTest.java failing after JDK-8302659 [v3]

Daniel Fuchs dfuchs at openjdk.org
Mon Mar 20 19:10:38 UTC 2023


On Mon, 20 Mar 2023 17:53:55 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> Please review this change that fixes and reenables OptionsTest on Windows.
>> 
>> The test is checking that the values retrieved from getOption match the values set by an earlier call to setOption. The `IP_MULTICAST_IF` option was tested with the first network interface for which `supportsMulticast` returned true. JDK-8302659 changed the network interface iteration order and the test started failing.
>> 
>> The proposed change is to verify if the interface is actually usable for multicasting before using it in set/get test. Test passed on all platforms.
>
> Daniel Jeliński has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use NetworkConfiguration

test/jdk/java/net/SocketOption/options.policy line 34:

> 32: };
> 33: // for JTwork/classes/test/lib/jdk/test/lib/NetworkConfiguration.class
> 34: grant codeBase "file:${test.classes}/../../../../test/lib/-" {

A single grant clause with the two permissions should be enough - since both classes are in the same codebase. Also I thought the plan was to grant `SocketPermission "*:*" ...` to the test? If so then you could simply add the two permissions to the global grant clause. No need to distinguish between the permissions granted to the library and the permissions granted to the test.

test/lib/jdk/test/lib/NetworkConfiguration.java line 399:

> 397:             List<InetAddress> addrList = AccessController.doPrivileged(
> 398:                     (PrivilegedAction<List<InetAddress>>) () -> list(nif.getInetAddresses()));
> 399:             for (InetAddress addr : addrList) {

Suggestion:

            PrivilegedAction<List<InetAddress>> listaddr = () -> list(nif.getInetAddresses());
            @SuppressWarnings("removal")
            List<InetAddress> addrList = AccessController.doPrivileged(listaddr);
            for (InetAddress addr : addrList) {

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13061#discussion_r1142563619
PR Review Comment: https://git.openjdk.org/jdk/pull/13061#discussion_r1142567270


More information about the net-dev mailing list