comparison src/org/tmatesoft/hg/internal/DataAccessProvider.java @ 404:31a719b9f95e smartgit3

Provide more detailed information on erroneous file operation
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 05 Mar 2012 15:15:49 +0100
parents 3cfa4d908fc9
children bb278ccf9866
comparison
equal deleted inserted replaced
399:fdc1db8f7f61 404:31a719b9f95e
235 } 235 }
236 236
237 @Override 237 @Override
238 public void seek(int offset) throws IOException { 238 public void seek(int offset) throws IOException {
239 if (offset > size) { 239 if (offset > size) {
240 throw new IllegalArgumentException(); 240 throw new IllegalArgumentException(String.format("Can't seek to %d for the file of size %d (buffer start:%d)", offset, size, bufferStartInFile));
241 } 241 }
242 if (offset < bufferStartInFile + buffer.limit() && offset >= bufferStartInFile) { 242 if (offset < bufferStartInFile + buffer.limit() && offset >= bufferStartInFile) {
243 buffer.position((int) (offset - bufferStartInFile)); 243 buffer.position((int) (offset - bufferStartInFile));
244 } else { 244 } else {
245 // out of current buffer, invalidate it (force re-read) 245 // out of current buffer, invalidate it (force re-read)