From feae8dd40035fba154942f3e4c91751981250a74 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sun, 8 Dec 2013 14:37:50 +0100 Subject: [PATCH] Add some debug information to the mssing decoder/encoder exception. --- .../protocol/injector/netty/ChannelInjector.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java index 66295b52..aa0cd50f 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java @@ -188,7 +188,7 @@ class ChannelInjector extends ByteToMessageDecoder { synchronized (networkManager) { if (originalChannel instanceof Factory) return false; - + // Don't inject the same channel twice if (findChannelHandler(originalChannel, ChannelInjector.class) != null) { // Invalidate cache @@ -202,9 +202,9 @@ class ChannelInjector extends ByteToMessageDecoder { vanillaEncoder = (MessageToByteEncoder) originalChannel.pipeline().get("encoder"); if (vanillaDecoder == null) - throw new IllegalArgumentException("Unable to find vanilla decoder.in " + originalChannel.pipeline()); + throw new IllegalArgumentException("Unable to find vanilla decoder.in " + originalChannel.pipeline() + ". " + getChannelState()); if (vanillaEncoder == null) - throw new IllegalArgumentException("Unable to find vanilla encoder in " + originalChannel.pipeline()); + throw new IllegalArgumentException("Unable to find vanilla encoder in " + originalChannel.pipeline() + ". " + getChannelState()); patchEncoder(vanillaEncoder); if (DECODE_BUFFER == null) @@ -245,6 +245,10 @@ class ChannelInjector extends ByteToMessageDecoder { } } + private String getChannelState() { + return "Registered channel: " + originalChannel.isRegistered() + ", Active channel: " + originalChannel.isActive() + ", Open channel: " + originalChannel.isOpen(); + } + /** * Process a given message on the packet listeners. * @param message - the message/packet.