Report invalid chars
[jalview.git] / src / jalview / io / MSFfile.java
index 179204e..bae4342 100755 (executable)
@@ -70,7 +70,7 @@ public class MSFfile extends AlignFile
     /**\r
      * DOCUMENT ME!\r
      */\r
-    public void parse()\r
+    public void parse() throws IOException\r
     {\r
         int i = 0;\r
         boolean seqFlag = false;\r
@@ -147,9 +147,6 @@ public class MSFfile extends AlignFile
                 String head = headers.elementAt(i).toString();\r
                 String seq = seqhash.get(head).toString();\r
 \r
-                int start = -1;\r
-                int end =  -1;\r
-\r
                 if (maxLength < head.length())\r
                 {\r
                     maxLength = head.length();\r
@@ -157,8 +154,17 @@ public class MSFfile extends AlignFile
 \r
                 // Replace ~ with a sensible gap character\r
                 seq = seq.replace('~', '-');\r
+                if (!isValidProteinSequence(seq))\r
+                {\r
+                    throw new IOException(AppletFormatAdapter.\r
+                                          INVALID_CHARACTERS\r
+                                          + " : " + head\r
+                                          + " : " + invalidCharacter);\r
+                }\r
+\r
 \r
                 Sequence newSeq = parseId(head);\r
+\r
                 newSeq.setSequence(seq);\r
 \r
                 seqs.addElement(newSeq);\r