On Mon, 2 Jan 2023 16:16:08 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:
> We have a couple of places where a SocketException is thrown but the cause is > omitted. It would be beneficial for example in error analysis not to throw > away the cause (causing exception) but to add it to the created > SocketException. src/java.base/share/classes/java/net/ServerSocket.java line 697: > 695: if (thread.isVirtual() && thread.isInterrupted()) { > 696: close(); > 697: throw new SocketException("Closed by interrupt", e); The InterruptedIOException is used by the SocketImpl to communicate the interrupt to the ServerSocket. It should not be added a cause here. Same thing in the Socket code. src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java line 313: > 311: } catch (ConnectionResetException e) { > 312: connectionReset = true; > 313: throw new SocketException("Connection reset", e); This is internal exception and should not be added as a cause here. ------------- PR: https://git.openjdk.org/jdk/pull/11813