[apache5-client] Fail fast when SecurityManager lacks TCP_KEEPIDLE/TCP_KEEPINTERVAL/TCP_KEEPCOUNT permissions.#6992
Conversation
…ctive and jdk.net.NetworkPermission setOption.TCP_KEEPIDLE, setOption.TCP_KEEPINTERVAL, setOption.TCP_KEEPCOUNT are not granted
| } | ||
|
|
||
| try { | ||
| Class<?> permClass = ClassLoaderHelper.loadClass("jdk.net.NetworkPermission", Apache5HttpClient.class); |
There was a problem hiding this comment.
Note that NetworkPermission is marked for forRemoval in Java 25 thus loading it from ClassLoaderHelper to prevent ClassNotFoundException for future Java versions.
https://docs.oracle.com/en/java/javase/26/docs/api/jdk.net/jdk/net/NetworkPermission.html
…eption other than one expected
b696460 to
697b152
Compare
|
Not a blocker, but can we add a test that uses a security manager with expected permissions enabled + makes an API call so we can catch any instances where more permissions have to be granted, for example in a new Apache 5.x minor version. |
Good call out. |
Motivation and Context
Modifications
jkdk.net.NetworkPermissionentries when a SecurityManager is active.IllegalStateExceptionlisting the missing permissions at client construction time instead of AccessControlException at first request.Testing
Screenshots (if appropriate)
Types of changes
License