Catch numberformatexceptions
authoramwaterhouse <Andrew Waterhouse>
Mon, 31 Oct 2005 15:52:49 +0000 (15:52 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 31 Oct 2005 15:52:49 +0000 (15:52 +0000)
src/jalview/io/AlignFile.java

index 3a05402..5b94eb8 100755 (executable)
@@ -199,20 +199,27 @@ public abstract class AlignFile extends FileParse
       if (id.indexOf("/") > 0)\r
       {\r
         st = new StringTokenizer(id, "/");\r
+        String limits=null;\r
+        try{\r
+          if (st.countTokens() == 2)\r
+          {\r
+            id = st.nextToken();\r
 \r
-        if (st.countTokens() == 2)\r
-        {\r
-          id = st.nextToken();\r
-\r
-          String tmp = st.nextToken();\r
+            limits = st.nextToken();\r
 \r
-          st = new StringTokenizer(tmp, "-");\r
+            st = new StringTokenizer(limits, "-");\r
 \r
-          if (st.countTokens() == 2)\r
-          {\r
-            seq.setStart( Integer.valueOf(st.nextToken()).intValue() );\r
-            seq.setEnd( Integer.valueOf(st.nextToken()).intValue() );\r
+            if (st.countTokens() == 2)\r
+            {\r
+              seq.setStart(Integer.valueOf(st.nextToken()).intValue());\r
+              seq.setEnd(Integer.valueOf(st.nextToken()).intValue());\r
+            }\r
           }\r
+        }catch(NumberFormatException ex)\r
+        {\r
+            // Problem parsing sequence limits. Just add it back to the\r
+          // Id so we dont lose this info\r
+          id += "/" + limits;\r
         }\r
       }\r
       seq.setName(id);\r