From 912aa7d86722d1b6a6bed00fa3fbee9d30af774b Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Wed, 22 May 2019 03:06:30 -0700 Subject: [PATCH] Don't double record stacktrace in Annotated*Exception (#9117) Motivation: When initializing the AnnotatedSocketException in AbstractChannel, both the cause and the stack trace are set, leaving a trailing "Caused By" that is compressed when printing the trace. Modification: Don't include the stack trace in the exception, but leave it in the cause. Result: Clearer stack trace --- transport/src/main/java/io/netty/channel/AbstractChannel.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/AbstractChannel.java b/transport/src/main/java/io/netty/channel/AbstractChannel.java index 676d057ec7..536ca7d9e3 100644 --- a/transport/src/main/java/io/netty/channel/AbstractChannel.java +++ b/transport/src/main/java/io/netty/channel/AbstractChannel.java @@ -1112,7 +1112,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) { super(exception.getMessage() + ": " + remoteAddress); initCause(exception); - setStackTrace(exception.getStackTrace()); } @Override @@ -1128,7 +1127,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha AnnotatedNoRouteToHostException(NoRouteToHostException exception, SocketAddress remoteAddress) { super(exception.getMessage() + ": " + remoteAddress); initCause(exception); - setStackTrace(exception.getStackTrace()); } @Override @@ -1144,7 +1142,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha AnnotatedSocketException(SocketException exception, SocketAddress remoteAddress) { super(exception.getMessage() + ": " + remoteAddress); initCause(exception); - setStackTrace(exception.getStackTrace()); } @Override