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 GitHub
parent 9893ac726f
commit 7a05aa1cf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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