Fix failing tests

This commit is contained in:
Trustin Lee 2013-01-18 13:34:00 +09:00
parent d0afe6cad0
commit b5c87b0f9c

View File

@ -976,7 +976,10 @@ public abstract class AbstractByteBuf implements ByteBuf {
protected final void checkIndex(int index, int fieldLength) {
checkUnfreed();
if (index < 0 || index > capacity() - fieldLength || fieldLength < 0) {
if (fieldLength < 0) {
throw new IllegalArgumentException("length: " + fieldLength + " (expected: >= 0)");
}
if (index < 0 || index > capacity() - fieldLength) {
throw new IndexOutOfBoundsException(String.format(
"index: %d, length: %d (expected: range(0, %d))", index, fieldLength, capacity()));
}