mirror of https://github.com/apache/lucene.git
improve exception messages when requested slice is out of bounds
This commit is contained in:
parent
2335a458d8
commit
60033b308a
|
@ -134,7 +134,7 @@ public class NIOFSDirectory extends FSDirectory {
|
|||
@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 class SimpleFSDirectory extends FSDirectory {
|
|||
@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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue