From 9955ef563e102cee36dee4e006ba20a63ff5f282 Mon Sep 17 00:00:00 2001 From: feijermu Date: Mon, 6 Jul 2020 16:19:22 +0800 Subject: [PATCH] Add detailed error message corresponding to the IndexOutOfBoundsException while calling getEntry(...) (#10386) Motivation: `getEntry(...)` may throw an IndexOutOfBoundsException without any error messages. Modification: Add detailed error message corresponding to the IndexOutOfBoundsException while calling `getEntry(...)` in HpackDynamicTable.java. Result: Easier to debug --- .../java/io/netty/handler/codec/http2/HpackDynamicTable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java index 6fda10d47e..f45d26cb32 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java @@ -83,7 +83,7 @@ final class HpackDynamicTable { */ public HpackHeaderField getEntry(int index) { if (index <= 0 || index > length()) { - throw new IndexOutOfBoundsException(); + throw new IndexOutOfBoundsException("Index " + index + " out of bounds for length " + length()); } int i = head - index; if (i < 0) {