[JAVA-4221] Confirm that SocketStreamHelper static initializer is catching right exceptions Created: 03/Jul/21  Updated: 27/Oct/23  Resolved: 14/Jul/21

Status: Closed
Project: Java Driver
Component/s: Internal
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Unknown
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

According to https://openjdk.java.net/jeps/403, on Java 17 access to jdk.net classes will throw an IllegalAccessError. The static initializer for SocketStreamHelper doesn't catch that exception. Instead it catches IllegalAccessException.

We should confirm what exception is actually thrown on Java 17 when running a test program using the driver with --illegal-access=deny.



 Comments   
Comment by Jeffrey Yemin [ 14/Jul/21 ]

It appears that jdk.net is supported even in Java 17, so closing as Works as Designed.

Comment by Jeffrey Yemin [ 12/Jul/21 ]

I am not currently clear why this is not a runtime exception in Java 17:

public class ExtendedSocketOptionsTest {
    public static void main(String[] args) {
        SocketOption<Integer> extendedSocketOptions = ExtendedSocketOptions.TCP_KEEPCOUNT;
        System.out.println(extendedSocketOptions.name());
        System.out.println(extendedSocketOptions.type());
    }
}

Generated at Thu Feb 08 09:01:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.