Skip to content

Commit

Permalink
Don't double record stacktrace in Annotated*Exception (netty#9117)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
carl-mastrangelo authored and normanmaurer committed May 22, 2019
1 parent 507e0a0 commit dea4e33
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions transport/src/main/java/io/netty/channel/AbstractChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,6 @@ private static final class AnnotatedConnectException extends ConnectException {
AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) {
super(exception.getMessage() + ": " + remoteAddress);
initCause(exception);
setStackTrace(exception.getStackTrace());
}

@Override
Expand All @@ -1180,7 +1179,6 @@ private static final class AnnotatedNoRouteToHostException extends NoRouteToHost
AnnotatedNoRouteToHostException(NoRouteToHostException exception, SocketAddress remoteAddress) {
super(exception.getMessage() + ": " + remoteAddress);
initCause(exception);
setStackTrace(exception.getStackTrace());
}

@Override
Expand All @@ -1196,7 +1194,6 @@ private static final class AnnotatedSocketException extends SocketException {
AnnotatedSocketException(SocketException exception, SocketAddress remoteAddress) {
super(exception.getMessage() + ": " + remoteAddress);
initCause(exception);
setStackTrace(exception.getStackTrace());
}

@Override
Expand Down

0 comments on commit dea4e33

Please sign in to comment.