From 0a7895a17bc2140c2e59ec04a8206102731ba5fd Mon Sep 17 00:00:00 2001
From: jprocter <Jim Procter>
Date: Fri, 24 Aug 2007 15:37:12 +0000
Subject: [PATCH] remove null pointer exception when embl file is not
 retrieved and comment about selecting for peptide or na
 sequences

---
 src/jalview/ws/dbsources/EmblXmlSource.java |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/jalview/ws/dbsources/EmblXmlSource.java b/src/jalview/ws/dbsources/EmblXmlSource.java
index 1300c65..3179110 100644
--- a/src/jalview/ws/dbsources/EmblXmlSource.java
+++ b/src/jalview/ws/dbsources/EmblXmlSource.java
@@ -23,10 +23,6 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     super();
   }
   /**
-   * set this to false to *not* add protein products to alignment dataset.
-   */
-  public boolean getProteinProducts=false;
-  /**
    * retrieve and parse an emblxml file
    * @param emprefx either EMBL or EMBLCDS strings are allowed - anything else will not retrieve emblxml
    * @param query
@@ -53,13 +49,19 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     }
     if (reply != null && reply.exists())
       {
+        efile=null;
         file = reply.getAbsolutePath();
-        efile = jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply);
+        if (reply.length()>25)
+        {
+            efile = jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply);
+        } else {
+          result.append("# No EMBL record retrieved for "+emprefx.toLowerCase()+":"+query.trim());
+        }
       }
       if (efile!=null) {
         for (Iterator i=efile.getEntries().iterator(); i.hasNext(); ) {
           EmblEntry entry = (EmblEntry) i.next();
-          SequenceI[] seqparts = entry.getSequences(false,!getProteinProducts, emprefx);
+          SequenceI[] seqparts = entry.getSequences(false, true, emprefx); // TODO: use !fetchNa,!fetchPeptide here instead - see todo in emblEntry
           if (seqparts!=null) {
             SequenceI[] newseqs = null;
             int si=0;
-- 
1.7.10.2