RFR: [XS] 8250770 : Net.java translateToSocketException does not handle IOException

Alan Bateman Alan.Bateman at oracle.com
Wed Jul 29 10:23:35 UTC 2020


On 29/07/2020 11:10, Baesken, Matthias wrote:
>
> Hello, it seems that  recent changes  to jdk/jdk caused that we see on 
> some Windows machines  in Net.java  translateToSocketException ,  that 
> an IOException  occurs :**
>
> Caused by: java.io.IOException: Network interface not configured for 
> IPv4" ; the IOException could (should?) be translated to a 
> SocketException in Net.java
>
> And this is unfortunately not (yet)  translated .
>
> My small change adds the “translation”  of the IOException to 
> translateToSocketException  .
>
> The issue was caused by a :
>
> Caused by: java.io.IOException: Network interface not configured for IPv4
> at 
> java.base/sun.nio.ch.DatagramChannelImpl.setOption(DatagramChannelImpl.java:376)
> at 
> java.base/sun.nio.ch.DatagramSocketAdaptor.setOption(DatagramSocketAdaptor.java:418)
> at 
> java.base/sun.nio.ch.DatagramSocketAdaptor.setNetworkInterface(DatagramSocketAdaptor.java:600)
>
> Bug/webrev :
>
> https://bugs.openjdk.java.net/browse/JDK-8250770
>
> http://cr.openjdk.java.net/~mbaesken/webrevs/8250770.0/
>
>
This seems to be a long standing issue in the socket adaptors. Legacy 
DatagramSocket/MulticastSocket delegate to a socket adaptor since JDK 15 
so I assume this is why you only see this now. Changing 
translateToSocketException seems okay but "IO error" is going to be 
confusing. Can you use x.getMessage() as the message instead?

-Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200729/9248c7a1/attachment.htm>


More information about the nio-dev mailing list