Check for invalid VCF records (not enough tokens) instead of assuming they are there.

This commit is contained in:
Eric Banks 2011-10-31 14:09:51 -04:00
parent bed0acaed4
commit f62af0291b
1 changed files with 4 additions and 1 deletions

View File

@ -155,7 +155,10 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec,
*/
public Feature decodeLoc(String line) {
String[] locParts = new String[6];
ParsingUtils.split(line, locParts, VCFConstants.FIELD_SEPARATOR_CHAR, true);
int nParts = ParsingUtils.split(line, locParts, VCFConstants.FIELD_SEPARATOR_CHAR, true);
if ( nParts != 6 )
throw new UserException.MalformedVCF("there aren't enough columns for line " + line, lineNo);
// get our alleles (because the end position depends on them)
String ref = getCachedString(locParts[3].toUpperCase());