JAL-3066 Check if annotation and features are present before fetching
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Mon, 7 Oct 2019 10:23:24 +0000 (11:23 +0100)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Mon, 7 Oct 2019 10:23:24 +0000 (11:23 +0100)
src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java

index 3a5899b..ad09f7a 100644 (file)
@@ -16,12 +16,10 @@ import jalview.ws.params.ArgumentI;
 import jalview.ws.params.WsParamSetI;
 import jalview.ws.uimodel.AlignAnalysisUIText;
 
-import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.IOError;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -117,18 +115,15 @@ public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements
       throw new IOError(e);
     }
     Alignment aln = new Alignment(seqs.toArray(new SequenceI[0]));
-    BufferedReader readerIn = new BufferedReader(new InputStreamReader(annotFile.getContent()));
-    if (!new AnnotationFile().parseAnnotationFrom(aln, null, readerIn))
+    if (annotFile == null
+        || !new AnnotationFile().readAnnotationFile(aln, annotFile.getURL().toString(), DataSourceType.URL))
     {
       Cache.log.debug("No annotation from slivka job\n" + annotFile);
     }
-    if (featFile != null)
+    if (featFile == null
+        || !new FeaturesFile(featFile.getURL().toString(), DataSourceType.URL).parse(aln, featureColours, true))
     {
-      if (!new FeaturesFile(featFile.getURL().toString(),
-              DataSourceType.URL).parse(aln, featureColours, true))
-      {
-        Cache.log.debug("No features from slivka job\n" + featFile);
-      }
+      Cache.log.debug("No features from slivka job\n" + featFile);
     }
     return Arrays.asList(aln.getAlignmentAnnotation());
   }