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

Daniel Fuchs daniel.fuchs at oracle.com
Wed Jul 29 10:29:31 UTC 2020


Hi Matthias,

On 29/07/2020 11:23, Alan Bateman wrote:
>> 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?


I agree with Alan that at least the message of the original
exception should be kept. I wonder if we should keep the
original IOException as the cause as well.

Something like:

    nx = new SocketException(x.getMessage());
    nx.initCause(x);

best regards,

-- daniel


More information about the nio-dev mailing list