RFR: 8372661: Add a null-safe static factory method to "jdk.test.lib.net.SimpleSSLContext"
Volkan Yazici
vyazici at openjdk.org
Thu Dec 11 12:25:22 UTC 2025
On Thu, 11 Dec 2025 09:45:54 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
> Overhauls `SimpleSSLContext` to remove the need for null checks at the call site, and to accept a key store file search path, which removes the need to copy-paste `SimpleSSLContext` just to change the search path.
>
> ### Tips for reviewers
>
> 1. Start from `SimpleSSLContext.java`
> 2. See how `test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SimpleSSLContext.java` is renamed to `test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SimpleSSLContextWhiteboxAdapter.java` and how `@compile/module=java.net.http .../SimpleSSLContext.java` JTreg tag is used to inject `SimpleSSLContext`
Tier1-2 is clear on 326fd60e352.
test/lib/jdk/test/lib/net/SimpleSSLContext.java line 1:
> 1: /*
[JDK-8372661] suggests `newSSLContext` as the method name, though I opted for `findSSLContext` and `loadSSLContext` method names, because
1. `newSSLContext` clashes with IDEs auto-completion when one types `ClassName.new`
2. `findSSLContext` makes the intent more clear, because we indeed search for a key store file, and then load it
3. `loadSSLContext` makes the intent more clear, because it only and only tries to load an `SSLContext` from the provided key store file; it doesn't do a search or anything else.
[JDK-8372661]: https://bugs.openjdk.org/browse/JDK-8372661
test/lib/jdk/test/lib/net/SimpleSSLContext.java line 77:
> 75: * one cannot be loaded
> 76: */
> 77: public static SSLContext findSSLContext(String keyStoreFileRelPath, String protocol) {
This is made public to enable loading a key store file from alternative locations, which is required by whitebox tests.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28765#issuecomment-3641655710
PR Review Comment: https://git.openjdk.org/jdk/pull/28765#discussion_r2609917169
PR Review Comment: https://git.openjdk.org/jdk/pull/28765#discussion_r2609927102
More information about the security-dev
mailing list