RFR: JDK-8299475: Enhance SocketException by cause where it is missing in net and nio area
Alan Bateman
alanb at openjdk.org
Mon Jan 2 16:56:50 UTC 2023
On Mon, 2 Jan 2023 16:16:08 GMT, Matthias Baesken <mbaesken at 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 302:
> 300: throw e;
> 301: } catch (IOException e) {
> 302: throw new SocketException(e.getMessage(), e);
This one is probably okay although most of the stack trace of the cause will be identical to that of the SocketException so it might be confusing in logs. The equivalent in Socket might be a bit more useful as there are several SocketImpls used for client sockets.
-------------
PR: https://git.openjdk.org/jdk/pull/11813
More information about the nio-dev
mailing list