GeezerVison is showing github.com — Replace `ClosedChannelException` with `StacklessClosedChannelExceptio… · netty/netty@70d6e9b
File tree
Expand file treeCollapse file tree
Open diff view settings
handler/src/main/java/io/netty/handler/ssl transport/src/main/java/io/netty/channel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: handler/src/main/java/io/netty/handler/ssl/SslHandler.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
30 | 30 | import io.netty.channel.ChannelOutboundHandler; |
31 | 31 | import io.netty.channel.ChannelPipeline; |
32 | 32 | import io.netty.channel.ChannelShutdownType; |
| 33 | +import io.netty.channel.StacklessClosedChannelException; |
33 | 34 | import io.netty.channel.unix.UnixChannel; |
34 | 35 | import io.netty.handler.codec.ByteToMessageDecoder; |
35 | 36 | import io.netty.handler.codec.DecoderException; |
|
51 | 52 |
|
52 | 53 | import java.io.IOException; |
53 | 54 | import java.nio.ByteBuffer; |
54 | | -import java.nio.channels.ClosedChannelException; |
55 | 55 | import java.nio.channels.DatagramChannel; |
56 | 56 | import java.nio.channels.SocketChannel; |
57 | 57 | import java.security.cert.CertificateException; |
@@ -1123,7 +1123,8 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception { |
1123 | 1123 | boolean handshakeFailed = handshakePromise.cause() != null; |
1124 | 1124 |
|
1125 | 1125 | // Channel closed, we will generate 'ClosedChannelException' now. |
1126 | | - ClosedChannelException exception = new ClosedChannelException(); |
| 1126 | + StacklessClosedChannelException exception = StacklessClosedChannelException.newInstance( |
| 1127 | + SslHandler.class, "channelInactive(ChannelHandlerContext)"); |
1127 | 1128 |
|
1128 | 1129 | // Add a supressed exception if the handshake was not completed yet. |
1129 | 1130 | if (isStateSet(STATE_HANDSHAKE_STARTED) && !handshakePromise.isDone()) { |
|
Collapse file
Copy file name to clipboardExpand all lines: transport/src/main/java/io/netty/channel/StacklessClosedChannelException.java +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
16 | 16 | package io.netty.channel; |
17 | 17 |
|
18 | 18 | import io.netty.util.internal.ThrowableUtil; |
| 19 | +import io.netty.util.internal.UnstableApi; |
19 | 20 |
|
20 | 21 | import java.nio.channels.ClosedChannelException; |
21 | 22 |
|
22 | 23 | /** |
23 | 24 | * Cheap {@link ClosedChannelException} that does not fill in the stacktrace. |
24 | 25 | */ |
25 | | -final class StacklessClosedChannelException extends ClosedChannelException { |
| 26 | +@UnstableApi |
| 27 | +public final class StacklessClosedChannelException extends ClosedChannelException { |
26 | 28 |
|
27 | 29 | private static final long serialVersionUID = -2214806025529435136L; |
28 | 30 |
|
@@ -37,7 +39,7 @@ public Throwable fillInStackTrace() { |
37 | 39 | /** |
38 | 40 | * Creates a new {@link StacklessClosedChannelException} which has the origin of the given {@link Class} and method. |
39 | 41 | */ |
40 | | - static StacklessClosedChannelException newInstance(Class<?> clazz, String method) { |
| 42 | + public static StacklessClosedChannelException newInstance(Class<?> clazz, String method) { |
41 | 43 | return ThrowableUtil.unknownStackTrace(new StacklessClosedChannelException(), clazz, method); |
42 | 44 | } |
43 | 45 | } |