On Thu, 23 Apr 2026 07:08:40 GMT, Daniel Jeliński <[email protected]> wrote:

>> Artur Barashev has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Throw an exception when getUseClientMode() is called before 
>> setUseClientMode(). Remove any notion of default from SSLEngine javadoc
>
> 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.

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

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

Reply via email to