RFR: 8323999: KeyAgreement cannot be initiated again after a failed initialization [v2]

Matthew Donovan mdonovan at openjdk.org
Mon Nov 3 13:16:18 UTC 2025


On Mon, 3 Nov 2025 10:46:22 GMT, Mikhail Yankelevich <myankelevich at openjdk.org> wrote:

>> Matthew Donovan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixed whitespace and @test block
>
> src/java.base/share/classes/javax/crypto/KeyAgreement.java line 377:
> 
>> 375: 
>> 376:             if (!serviceIterator.hasNext()) {
>> 377:                 serviceIterator = GetInstance.getServices("KeyAgreement", algorithm);
> 
> Wouldn't it cause a change in behaviour of this method unnecessarily? It seems to me it might be a bit better to do this in the `init` methods calling `chooseProvider`. What do you think?

I don't understand what you mean about changing the behavior of the method. The behavior has to change somewhere, doesn't it?

I don't like the idea of moving this to the init() method because the code would have to be duplicated in two places and the init methods don't currently have any knowledge of how providers are chosen. it's unlikely but if the chooseProvider() implementation is changed that could force an unnecessary change to the init() methods.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28004#discussion_r2486448798


More information about the security-dev mailing list