From ae47ae3b89c841aa44f75c0885698ac3f909e44e Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sat, 18 Jul 2015 21:07:41 -0400 Subject: [PATCH] Only suppress ClosedChannelExceptions --- ProtocolLib/pom.xml | 6 ++++++ .../compat/netty/independent/NettyChannelInjector.java | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ProtocolLib/pom.xml b/ProtocolLib/pom.xml index 2b2433ed..05b1b6ab 100644 --- a/ProtocolLib/pom.xml +++ b/ProtocolLib/pom.xml @@ -243,6 +243,12 @@ + cglib cglib-nodep diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannelInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannelInjector.java index 5913dba7..41142b13 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannelInjector.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/NettyChannelInjector.java @@ -284,13 +284,11 @@ public class NettyChannelInjector extends ByteToMessageDecoder implements Channe ChannelHandlerAdapter exceptionHandler = new ChannelHandlerAdapter() { @Override - public void exceptionCaught(ChannelHandlerContext context, Throwable ex) throws Exception { - if (ex instanceof ClosedChannelException) { + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + if (cause instanceof ClosedChannelException) { // Ignore } else { - // TODO Actually handle exceptions? - System.err.println("[ProtocolLib] Encountered an uncaught exception in the channel pipeline:"); - ex.printStackTrace(); + super.exceptionCaught(ctx, cause); } } }; @@ -821,7 +819,7 @@ public class NettyChannelInjector extends ByteToMessageDecoder implements Channe // we end up with a deadlock. The main thread is waiting for the worker thread to process the task, and // the worker thread is waiting for the main thread to finish executing PlayerQuitEvent. // - // TLDR: Concurrency is hard. + // TL;DR: Concurrency is hard. executeInChannelThread(new Runnable() { @Override public void run() {