JAL-3692 EMBL flatfile fetcher / parser (todo: CDS dbrefs and mappings)
[jalview.git] / src / jalview / ws / ebi / EBIFetchClient.java
index b5a7328..6914b70 100644 (file)
@@ -91,7 +91,7 @@ public class EBIFetchClient
    *          the query formatted as db:query1;query2;query3
    * @param format
    *          the format wanted
-   * @param extension
+   * @param ext
    *          for the temporary file to hold response (without separator)
    * @return the file holding the response
    * @throws OutOfMemoryError
@@ -202,6 +202,7 @@ public class EBIFetchClient
   {
     String url = buildUrl(ids, database, format);
     InputStream is = null;
+    BufferedReader br = null;
     try
     {
       URL rcall = new URL(url);
@@ -215,7 +216,7 @@ public class EBIFetchClient
           Platform.streamToFile(is, outFile);
           return null;
         }
-        BufferedReader br = new BufferedReader(new InputStreamReader(is));
+        br = new BufferedReader(new InputStreamReader(is));
         String rtn;
         List<String> arl = new ArrayList<>();
         while ((rtn = br.readLine()) != null)
@@ -251,6 +252,15 @@ public class EBIFetchClient
         {
         }
       }
+      if (br != null)
+      {
+        try
+        {
+          br.close();
+        } catch (IOException e)
+        {
+        }
+      }
     }
     return null;
   }
@@ -269,8 +279,9 @@ public class EBIFetchClient
     if (database.equalsIgnoreCase(DBRefSource.EMBL)
             || database.equalsIgnoreCase(DBRefSource.EMBLCDS))
     {
-      url = "https://www.ebi.ac.uk/ena/data/view/" + ids.toLowerCase()
-              + (format != null ? "&" + format : "");
+//      url = "https://www.ebi.ac.uk/ena/data/view/" + ids.toLowerCase()
+//              + (format != null ? "&" + format : "");
+      url = "https://www.ebi.ac.uk/ena/browser/api/embl/" + ids.toLowerCase();
     }
     else
     {