fix merge conflicts for finess on JAL-1140 (introduced by 1a8f953dd71a9e319e910261927...
[jalview.git] / src / jalview / io / RnamlFile.java
index 0029e60..1d14dae 100644 (file)
@@ -20,6 +20,7 @@ package jalview.io;
 import java.io.BufferedReader;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Vector;
 import java.util.regex.Matcher;
@@ -29,20 +30,19 @@ import jalview.analysis.SecStrConsensus;
 import jalview.analysis.SecStrConsensus.SimpleBP;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Annotation;
-import jalview.datamodel.SecondaryStructureAnnotation;
 import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
 import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
-import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 import fr.orsay.lri.varna.factories.RNAFactory;
-import fr.orsay.lri.varna.factories.RNAFactory.RNAFileType;
 import fr.orsay.lri.varna.models.rna.RNA;
-import fr.orsay.lri.varna.utils.RNAMLParser;
 
+/**
+ * @author jimp
+ *
+ */
 public class RnamlFile extends AlignFile {
        public int id;
        public String namefile;
@@ -72,8 +72,25 @@ public class RnamlFile extends AlignFile {
                return r;
        }
 
+       /* (non-Javadoc)
+        * @see jalview.io.AlignFile#parse()
+        */
+       public void parse() throws IOException
+       {
+        // rather than lose exception semantics whilst parsing RNAML with VARNA we
+        // wrap the routine and catch all exceptions before passing them up the
+        // chain as an IOException
+         try {
+           _parse();
+         } catch (Exception x)
+         {
+           error=true;
+           errormessage="Problem parsing data as RNAML ("+x.getMessage()+")";
+           throw new IOException("Couldn't parse the datasource as RNAML",x);
+         }
+       }
        @SuppressWarnings("unchecked")
-       public void parse() throws FileNotFoundException,
+       public void _parse() throws FileNotFoundException,
                        ExceptionPermissionDenied, ExceptionLoadingFailed,
                        ExceptionFileFormatOrSyntax {