Skip to content

Commit

Permalink
Improve IndexOutOfBoundsException message
Browse files Browse the repository at this point in the history
  • Loading branch information
isnotinvain committed Feb 23, 2015
1 parent 64d6c7f commit a257ee4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ public void write(int b) {
public void write(byte b[], int off, int len) {
if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) - b.length > 0)) {
throw new IndexOutOfBoundsException(String.format("len: %d, off: %d", len, off));
throw new IndexOutOfBoundsException(
String.format("Given byte array of size %d, with requested length(%d) and offset(%d)", b.length, len, off));
}
if (currentSlabIndex + len >= currentSlab.length) {
final int length1 = currentSlab.length - currentSlabIndex;
Expand Down

0 comments on commit a257ee4

Please sign in to comment.