On Mon, 25 Nov 2024 09:26:03 GMT, Volkan Yazıcı <d...@openjdk.org> wrote:

>> I don't mind if we have a broader try-finally but it would be a bug if 
>> connect were to throw IAE. All the validation should be done before 
>> delegating to the SocketImpl.
>
> @AlanBateman, this assertion causes `IDNTest` to fail:
> 
> 
> java.lang.AssertionError
>       at java.base/java.net.Socket.<init>(Socket.java:457)
>       at java.base/java.net.Socket.<init>(Socket.java:276)
>       at IDNTest.main(IDNTest.java:37)
> 
> 
> How shall I proceed?

Mark Sheppard spotted that too, see exchange in JBS issue. You can drop the 
!isUnresolved from the assert or eagerly throw UHE if attempting to creating a 
Socket with an unresolved address, either is fine but probably simple to adjust 
the assert. The downside is that if someone creates a Socket with an unresolved 
address then it will create a SocketImpl and attempt to connect before it 
detects the bad input. It's a corner case so not a big deal.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22160#discussion_r1856235829

Reply via email to