From 13856cc06222d23571f7ef2fc31b9da03a56ba12 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Mon, 7 Oct 2019 11:23:24 +0100 Subject: [PATCH] JAL-3066 Check if annotation and features are present before fetching --- .../ws/slivkaws/SlivkaAnnotationServiceInstance.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java index 3a5899b..ad09f7a 100644 --- a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java +++ b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java @@ -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()); } -- 1.7.10.2