catch a malformed column header name more gracefully

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1453 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-08-21 21:05:28 +00:00
parent 0364f8e989
commit b316abd20f
1 changed files with 7 additions and 1 deletions

View File

@ -146,7 +146,13 @@ public class VCFReader implements Iterator<VCFRecord>, Iterable<VCFRecord> {
if (str.startsWith("#") && !str.startsWith("##")) {
String[] strings = str.substring(1).split("\\s+");
for (String s : strings) {
if (headerFields.contains(VCFHeader.HEADER_FIELDS.valueOf(s)))
VCFHeader.HEADER_FIELDS field;
try {
field = VCFHeader.HEADER_FIELDS.valueOf(s);
} catch (IllegalArgumentException e) {
throw new RuntimeException("VCFReader: Unknown column name \"" + s + "\", it does not match a known column header name.");
}
if (headerFields.contains(field))
throw new RuntimeException("VCFReader: Header field duplication is not allowed");
try {
headerFields.add(VCFHeader.HEADER_FIELDS.valueOf(s));