Prevent NumberFormatExceptions when parsing the VCF POS field
This commit is contained in:
parent
e1bba91836
commit
8f95a03bb6
|
|
@ -237,7 +237,12 @@ public abstract class AbstractVCFCodec extends AsciiFeatureCodec<VariantContext>
|
||||||
// parse out the required fields
|
// parse out the required fields
|
||||||
final String chr = getCachedString(parts[0]);
|
final String chr = getCachedString(parts[0]);
|
||||||
builder.chr(chr);
|
builder.chr(chr);
|
||||||
int pos = Integer.valueOf(parts[1]);
|
int pos = -1;
|
||||||
|
try {
|
||||||
|
pos = Integer.valueOf(parts[1]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
generateException(parts[1] + " is not a valid start position in the VCF format");
|
||||||
|
}
|
||||||
builder.start(pos);
|
builder.start(pos);
|
||||||
|
|
||||||
if ( parts[2].length() == 0 )
|
if ( parts[2].length() == 0 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue