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
This commit is contained in:
feijermu 2020-07-06 16:19:22 +08:00 committed by Norman Maurer
parent f9e8c9ca11
commit 9955ef563e

View File

@ -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) {