Skip to content
Permalink
Browse files

improve exception messages when requested slice is out of bounds

  • Loading branch information...
mikemccand committed Apr 14, 2016
1 parent 2335a45 commit 60033b308ac721aff340b86d6776ce47cfbb63aa
@@ -134,7 +134,7 @@ public NIOFSIndexInput clone() {
@Override
public IndexInput slice(String sliceDescription, long offset, long length) throws IOException {
if (offset < 0 || length < 0 || offset + length > this.length()) {
throw new IllegalArgumentException("slice() " + sliceDescription + " out of bounds: " + this);
throw new IllegalArgumentException("slice() " + sliceDescription + " out of bounds: offset=" + offset + ",length=" + length + ",fileLength=" + this.length() + ": " + this);
}
return new NIOFSIndexInput(getFullSliceDescription(sliceDescription), channel, off + offset, length, getBufferSize());
}
@@ -130,7 +130,7 @@ public SimpleFSIndexInput clone() {
@Override
public IndexInput slice(String sliceDescription, long offset, long length) throws IOException {
if (offset < 0 || length < 0 || offset + length > this.length()) {
throw new IllegalArgumentException("slice() " + sliceDescription + " out of bounds: " + this);
throw new IllegalArgumentException("slice() " + sliceDescription + " out of bounds: offset=" + offset + ",length=" + length + ",fileLength=" + this.length() + ": " + this);
}
return new SimpleFSIndexInput(getFullSliceDescription(sliceDescription), channel, off + offset, length, getBufferSize());
}

0 comments on commit 60033b3

Please sign in to comment.
You can’t perform that action at this time.