JAL-1855 fail gracefully if XML has no <sequence> element
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 18 Aug 2016 14:25:52 +0000 (15:25 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 18 Aug 2016 14:25:52 +0000 (15:25 +0100)
src/jalview/datamodel/xdb/embl/EmblEntry.java

index 56b1325..06e929d 100644 (file)
@@ -49,8 +49,7 @@ import java.util.regex.Pattern;
  * Castor binding file
  * 
  * For example:
- * http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=ena_sequence&id=J03321
- * &format=emblxml
+ * http://www.ebi.ac.uk/ena/data/view/J03321&display=xml
  * 
  * @see embl_mapping.xml
  */
@@ -188,6 +187,10 @@ public class EmblEntry
   public SequenceI getSequence(String sourceDb, List<SequenceI> peptides)
   {
     SequenceI dna = makeSequence(sourceDb);
+    if (dna == null)
+    {
+      return null;
+    }
     dna.setDescription(description);
     DBRefEntry retrievedref = new DBRefEntry(sourceDb,
             getSequenceVersion(), accession);
@@ -240,6 +243,12 @@ public class EmblEntry
    */
   SequenceI makeSequence(String sourceDb)
   {
+    if (sequence == null)
+    {
+      System.err.println("No sequence was returned for ENA accession "
+              + accession);
+      return null;
+    }
     SequenceI dna = new Sequence(sourceDb + "|" + accession,
             sequence.getSequence());
     return dna;