On Thu, 23 Apr 2026 15:06:28 GMT, Artur Barashev <[email protected]> wrote:

>> src/java.base/share/classes/javax/net/ssl/SSLEngine.java line 1170:
>> 
>>> 1168:      * The JDK SunJSSE provider implementation requires that the 
>>> desired mode
>>> 1169:      * be set explicitly by calling {@link 
>>> #setUseClientMode(boolean)} before
>>> 1170:      * invoking this method.
>> 
>> Should we add `@throws IllegalStateException` here? We have it on 
>> `beginHandshake`, but not on `wrap`/`unwrap` currently.
>
> I actually see this `@throws` section in `wrap/unwrap` javadoc as well. But 
> this brings a good point: `@throws` section should be 
> implementation-independent, but we currently have the following text in 
> `SSLContext.java‎`:
> 
> 
>      * It is provider-specific if the returned SSLEngine uses client or
>      * server mode by default for the (D)TLS connection, or requires the
>      * mode to be set.
> 
> 
> So I think we should either remove that text from `SSLContext.java‎` or 
> remove the `@throws` sections in `SSLEngine`. In the former case we would 
> also add `@throws` section to `getUseClientMode()` javadoc.

I added `@throws` section to `getUseClientMode()`. Basically, in the following 
text by `set` we mean `set by user` OR `set by default`:

* @throws  IllegalStateException if the client/server mode
*          has not yet been set.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30754#discussion_r3169538886

Reply via email to