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

Alan Bateman alanb at openjdk.org
Tue Jan 3 09:18:51 UTC 2023


On Tue, 3 Jan 2023 08:50:10 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> 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?

Our SocketImpls mostly throw SocketException so inserting the catch of SocketException will avoid the translation for most cases.

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

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


More information about the nio-dev mailing list