From: gmungoc Date: Thu, 18 Aug 2016 14:25:52 +0000 (+0100) Subject: JAL-1855 fail gracefully if XML has no element X-Git-Tag: Release_2_10_0~100^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=37a676fbccf128b7dd362a9721ceba057c0e97e7;p=jalview.git JAL-1855 fail gracefully if XML has no element --- diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index 56b1325..06e929d 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -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 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;