From 005fd55b8805ee2d510355395c199bc6a7912cc9 Mon Sep 17 00:00:00 2001 From: Dmitriy Dumanskiy Date: Sat, 3 Aug 2019 13:20:41 +0300 Subject: [PATCH] #7285 Improved "Discarded inbound message" warning for embedded channel (#9414) Motivation: Look like `EmbeddedChannelPipeline` should also override `onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)` in order to do not print "Discarded message pipeline" because in case of `EmbeddedChannelPipeline` discarding actually not happens. This fixes next warning in the latest netty version with websocket and `WebSocketServerCompressionHandler`: ``` 13:36:36.231 DEBUG- Decoding WebSocket Frame opCode=2 13:36:36.231 DEBUG- Decoding WebSocket Frame length=5 13:36:36.231 DEBUG- Discarded message pipeline : [JdkZlibDecoder#0, DefaultChannelPipeline$TailContext#0]. Channel : [id: 0xembedded, L:embedded - R:embedded]. ``` Modification: Override correct method Result: Follow up fix after https://github.com/netty/netty/pull/9286 --- .../main/java/io/netty/channel/embedded/EmbeddedChannel.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java b/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java index d776b18119..976d0b0fbb 100644 --- a/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java +++ b/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java @@ -26,6 +26,7 @@ import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelId; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelMetadata; @@ -873,8 +874,8 @@ public class EmbeddedChannel extends AbstractChannel { } @Override - protected void onUnhandledInboundMessage(Object msg) { - handleInboundMessage(msg); + protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg) { + handleInboundMessage(msg); } } }