Need to catch RuntimeExceptions coming out of Picard too so that they show up as UserErrors (some BAM errors are thrown as REs).

This commit is contained in:
Eric Banks 2012-03-21 12:13:52 -04:00
parent d0056d6c71
commit ab1c48745b
1 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import net.sf.samtools.util.CloseableIterator;
import org.broadinstitute.sting.utils.exceptions.UserException;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
/**
@ -23,7 +24,7 @@ public class MalformedBAMErrorReformatingIterator implements CloseableIterator<S
public boolean hasNext() {
try {
return this.it.hasNext();
} catch ( SAMFormatException e ) {
} catch ( RuntimeException e ) { // we need to catch RuntimeExceptions here because the Picard code is throwing them (among SAMFileExceptions) sometimes
throw new UserException.MalformedBAM(source, e.getMessage());
}
}
@ -31,7 +32,7 @@ public class MalformedBAMErrorReformatingIterator implements CloseableIterator<S
public SAMRecord next() {
try {
return it.next();
} catch ( SAMFormatException e ) {
} catch ( RuntimeException e ) { // we need to catch RuntimeExceptions here because the Picard code is throwing them (among SAMFileExceptions) sometimes
throw new UserException.MalformedBAM(source, e.getMessage());
}
}