add more detail to exception message

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1697364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-08-24 12:27:47 +00:00
parent c1dc2fb6a6
commit ebaff1c4dc
1 changed files with 3 additions and 2 deletions

View File

@ -44,9 +44,10 @@ public abstract class ChecksumIndexInput extends IndexInput {
*/
@Override
public void seek(long pos) throws IOException {
final long skip = pos - getFilePointer();
final long curFP = getFilePointer();
final long skip = pos - curFP;
if (skip < 0) {
throw new IllegalStateException(getClass() + " cannot seek backwards");
throw new IllegalStateException(getClass() + " cannot seek backwards (pos=" + pos + " getFilePointer()=" + curFP + ")");
}
skipBytes(skip);
}