From c666f8aee30822a9d8e8932041707587b5cffb70 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 30 Aug 2011 11:22:31 +0100 Subject: [PATCH] ensure parsing errors and 'lack of data' errors are passed back as exceptions --- src/jalview/io/packed/ParsePackedSet.java | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/packed/ParsePackedSet.java b/src/jalview/io/packed/ParsePackedSet.java index 97802f3..9a4af62 100644 --- a/src/jalview/io/packed/ParsePackedSet.java +++ b/src/jalview/io/packed/ParsePackedSet.java @@ -8,6 +8,7 @@ import jalview.io.IdentifyFile; import jalview.io.packed.DataProvider.JvDataType; import java.io.BufferedReader; +import java.io.IOException; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; @@ -102,8 +103,13 @@ public class ParsePackedSet { br = new BufferedReader(src.getReader()); } - context.updateSetModified(new jalview.io.AnnotationFile() - .parseAnnotationFrom(context.getLastAlignment(), br)); + if (new jalview.io.AnnotationFile() + .parseAnnotationFrom(context.getLastAlignment(), br)) + { + context.updateSetModified(true); + } else { + errmsg = "Annotation file contained no data."; + } } catch (Exception e) { @@ -166,7 +172,20 @@ public class ParsePackedSet } } - + if (exerror!=null) + { + if (errmsg!=null && errmsg.length()>0) + { + throw new IOException(errmsg,exerror); + } else { + throw new IOException(errmsg,exerror); + } + } else { + if (errmsg!=null && errmsg.length()>0) + { + throw new IOException(errmsg); + } + } } if (deuniquify) { -- 1.7.10.2