From 02a310e8406f7cfbb5cf7a6d56b0bcec43761b08 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 31 Oct 2005 15:52:49 +0000 Subject: [PATCH] Catch numberformatexceptions --- src/jalview/io/AlignFile.java | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 3a05402..5b94eb8 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -199,20 +199,27 @@ public abstract class AlignFile extends FileParse if (id.indexOf("/") > 0) { st = new StringTokenizer(id, "/"); + String limits=null; + try{ + if (st.countTokens() == 2) + { + id = st.nextToken(); - if (st.countTokens() == 2) - { - id = st.nextToken(); - - String tmp = st.nextToken(); + limits = st.nextToken(); - st = new StringTokenizer(tmp, "-"); + st = new StringTokenizer(limits, "-"); - if (st.countTokens() == 2) - { - seq.setStart( Integer.valueOf(st.nextToken()).intValue() ); - seq.setEnd( Integer.valueOf(st.nextToken()).intValue() ); + if (st.countTokens() == 2) + { + seq.setStart(Integer.valueOf(st.nextToken()).intValue()); + seq.setEnd(Integer.valueOf(st.nextToken()).intValue()); + } } + }catch(NumberFormatException ex) + { + // Problem parsing sequence limits. Just add it back to the + // Id so we dont lose this info + id += "/" + limits; } } seq.setName(id); -- 1.7.10.2