From 37a676fbccf128b7dd362a9721ceba057c0e97e7 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 18 Aug 2016 15:25:52 +0100 Subject: [PATCH] JAL-1855 fail gracefully if XML has no element --- src/jalview/datamodel/xdb/embl/EmblEntry.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; -- 1.7.10.2