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
This commit is contained in:
Carl Mastrangelo 2019-05-22 03:06:30 -07:00 committed by Norman Maurer
parent 507e0a05b5
commit dea4e33c52

View File

@ -1164,7 +1164,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) { AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) {
super(exception.getMessage() + ": " + remoteAddress); super(exception.getMessage() + ": " + remoteAddress);
initCause(exception); initCause(exception);
setStackTrace(exception.getStackTrace());
} }
@Override @Override
@ -1180,7 +1179,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
AnnotatedNoRouteToHostException(NoRouteToHostException exception, SocketAddress remoteAddress) { AnnotatedNoRouteToHostException(NoRouteToHostException exception, SocketAddress remoteAddress) {
super(exception.getMessage() + ": " + remoteAddress); super(exception.getMessage() + ": " + remoteAddress);
initCause(exception); initCause(exception);
setStackTrace(exception.getStackTrace());
} }
@Override @Override
@ -1196,7 +1194,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
AnnotatedSocketException(SocketException exception, SocketAddress remoteAddress) { AnnotatedSocketException(SocketException exception, SocketAddress remoteAddress) {
super(exception.getMessage() + ": " + remoteAddress); super(exception.getMessage() + ": " + remoteAddress);
initCause(exception); initCause(exception);
setStackTrace(exception.getStackTrace());
} }
@Override @Override