RFR: JDK-8299475: Enhance SocketException by cause where it is missing in net and nio area [v2]

Matthias Baesken mbaesken at openjdk.org
Tue Jan 3 08:52:48 UTC 2023


On Tue, 3 Jan 2023 08:45:11 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   do not enhance some internal exceptions
>
> src/java.base/share/classes/java/net/Socket.java line 535:
> 
>> 533:             created = true;
>> 534:         } catch (IOException e) {
>> 535:             throw new SocketException(e.getMessage(), e);
> 
> For this one, you could `catch (SocketException e) { throw e; }` as the exception from the impl will be a SocketException anyway. That would help avoid the confusing cause.

Hi Alan, createImpl  throws SocketException anyway, so can't we just remove the catch completely in this case ?
Or are there other IOExceptions?

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

PR: https://git.openjdk.org/jdk/pull/11813


More information about the nio-dev mailing list