From 0f8e6a30ef62ce8b96852a41394f527da2c19f37 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 22 Oct 2020 09:05:46 +0200 Subject: [PATCH] DatagramDnsResponseDecoder should rethrow as CorruptedFrameException (#10714) Motivation: DatagramDnsResponseDecoder should rethrow as CorruptedFrameException if an IndexOutOfBoundsException happens. Modifications: - Catch IndexOutOfBoundsException and rethrow as CorruptedFrameException - Add a testcase Result: Less noise in the logs --- .../codec/dns/DatagramDnsResponseDecoder.java | 8 ++++++- .../handler/codec/dns/DnsResponseTest.java | 21 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseDecoder.java b/codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseDecoder.java index 674ecc612f..6258573690 100644 --- a/codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseDecoder.java +++ b/codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseDecoder.java @@ -18,6 +18,7 @@ package io.netty.handler.codec.dns; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.socket.DatagramPacket; +import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.util.internal.UnstableApi; @@ -54,7 +55,12 @@ public class DatagramDnsResponseDecoder extends MessageToMessageDecoder