JAL-2354 handle error response when fetching features
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 7 Dec 2016 13:13:46 +0000 (13:13 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 7 Dec 2016 13:13:46 +0000 (13:13 +0000)
src/jalview/ext/ensembl/EnsemblFeatures.java
src/jalview/ext/ensembl/EnsemblSeqProxy.java

index b28a37f..7570822 100644 (file)
@@ -85,6 +85,10 @@ class EnsemblFeatures extends EnsemblRestClient
     List<String> queries = new ArrayList<String>();
     queries.add(query);
     FileParse fp = getSequenceReader(queries);
+    if (fp == null || !fp.isValid())
+    {
+      return null;
+    }
     FeaturesFile fr = new FeaturesFile(fp);
     return new Alignment(fr.getSeqsAsArray());
   }
index 7aa7178..732bc0f 100644 (file)
@@ -233,7 +233,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
       EnsemblFeatureType[] features = getFeaturesToFetch();
       AlignmentI geneFeatures = gffFetcher.getSequenceRecords(accId,
               features);
-      if (geneFeatures.getHeight() > 0)
+      if (geneFeatures != null && geneFeatures.getHeight() > 0)
       {
         genomicSequence = geneFeatures.getSequenceAt(0);
       }