Fix correctness issue when dynamically merging many files.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5512 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2011-03-25 16:35:43 +00:00
parent c9283e6bc5
commit 8d8aed6a67
1 changed files with 5 additions and 0 deletions

View File

@ -159,6 +159,9 @@ public class BAMSchedule implements CloseableIterator<BAMScheduleEntry> {
final long readerStopOffset = position();
scheduleIterators.add(new PeekableIterator<BAMScheduleEntry>(new BAMScheduleIterator(reader,readerStartOffset,readerStopOffset,maxChunkCount)));
// Iterator initialization might move the file pointer. Make sure it gets reset back to where it was before iterator initialization.
position(readerStopOffset);
}
advance();
@ -296,6 +299,8 @@ public class BAMSchedule implements CloseableIterator<BAMScheduleEntry> {
private void write(final ByteBuffer buffer) {
try {
scheduleFileChannel.write(buffer);
if(buffer.remaining() > 0)
throw new ReviewedStingException("Unable to write entire buffer to file.");
}
catch(IOException ex) {
throw new ReviewedStingException("Unable to write data to BAM schedule file.",ex);