Merge branch 'releases/Release_2_10_2b1_Branch' Release_2_10_2b2
authorJim Procter <jprocter@issues.jalview.org>
Sun, 1 Oct 2017 11:44:34 +0000 (12:44 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Sun, 1 Oct 2017 11:44:34 +0000 (12:44 +0100)
RELEASE
help/html/releases.html
help/html/whatsNew.html
src/jalview/fts/service/pdb/PDBFTSRestClient.java
src/jalview/util/UrlConstants.java
src/jalview/ws/dbsources/Uniprot.java
src/jalview/ws/ebi/EBIFetchClient.java
test/jalview/ws/ebi/EBIFetchClientTest.java

diff --git a/RELEASE b/RELEASE
index e6b0cf8..cecefec 100644 (file)
--- a/RELEASE
+++ b/RELEASE
@@ -1,2 +1,2 @@
 jalview.release=releases/Release_2_10_2b1_Branch
-jalview.version=2.10.2b1
+jalview.version=2.10.2b2
index 5afe85c..4be594a 100755 (executable)
@@ -70,6 +70,32 @@ li:before {
     <tr>
       <td width="60" nowrap>
         <div align="center">
+          <strong><a name="Jalview.2.10.2b2">2.10.2b2</a><br />
+            <em>2/10/2017</em></strong>
+        </div>
+      </td>
+      <td><div align="left">
+          <em>New features in Jalview Desktop</em>
+          <ul>
+            <li>
+              <!-- JAL-2748 -->Uniprot Sequence Fetcher now uses web API at uniprot.org 
+              <!-- JAL-2745 -->HTTPS used for all connections to ebi.ac.uk 
+            </li>
+
+          </ul>
+        </div></td>
+      <td><div align="left">
+          <em></em>
+          <ul>
+            <li>
+              <!--  -->
+            </li>
+          </ul>
+        </div></td>
+    </tr>
+    <tr>
+      <td width="60" nowrap>
+        <div align="center">
           <strong><a name="Jalview.2.10.2b1">2.10.2b1</a><br />
             <em>7/9/2017</em></strong>
         </div>
@@ -147,7 +173,7 @@ li:before {
             </li>
           </ul>
         </div></td>
-    
+    </tr>    
     <tr>
       <td width="60" nowrap>
         <div align="center">
index 090b695..f12b9b5 100755 (executable)
 </head>
 <body>
   <p>
-    <strong>Jalview 2.10.2b1 bugfix release</strong>
+    <strong>Jalview 2.10.2b2 bugfix release</strong>
   </p>
   <p>
-    This is patch release for 2.10.2. See the <a
-      href="releases.html#Jalview.2.10.2b1">release notes</a> for full
-    details about the bugs addressed. This release also introduces
-    additional improvements to the overview panel, and patches for
-    several minor issues including the ability to correctly recover
-    cross-references for Uniprot protein sequences from Ensembl.
+    This is patch release for 2.10.2. See the
+    <a href="releases.html#Jalview.2.10.2b2">release notes</a> for full
+    details about the bugs addressed. This second patch release fixes
+    problems with the Uniprot sequence fetcher and introduces secure SSL
+    connections for access to EMBL-EBI resources. The previous patch
+    release introduced additional improvements to the overview panel,
+    and patches for several minor issues including the ability to
+    correctly recover cross-references for Uniprot protein sequences
+    from Ensembl.
   </p>
   <p>
     <strong>What's new in Jalview 2.10.2 ?</strong>
index a483f44..cbeaff1 100644 (file)
@@ -59,7 +59,7 @@ public class PDBFTSRestClient extends FTSRestClient
 
   private static FTSRestClientI instance = null;
 
-  public static final String PDB_SEARCH_ENDPOINT = "http://www.ebi.ac.uk/pdbe/search/pdb/select?";
+  public static final String PDB_SEARCH_ENDPOINT = "https://www.ebi.ac.uk/pdbe/search/pdb/select?";
 
   protected PDBFTSRestClient()
   {
index 3347cc7..d6ece8d 100644 (file)
@@ -55,7 +55,7 @@ public class UrlConstants
    * Default sequence URL link string for EMBL-EBI search
    */
   public static final String DEFAULT_STRING = DEFAULT_LABEL
-          + "|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$";
+          + "|https://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$";
 
   /*
    * not instantiable
index 30808fb..6c26f45 100644 (file)
@@ -30,13 +30,13 @@ import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.UniprotEntry;
 import jalview.datamodel.UniprotFile;
-import jalview.ws.ebi.EBIFetchClient;
 import jalview.ws.seqfetcher.DbSourceProxyImpl;
 
-import java.io.File;
-import java.io.FileReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.Vector;
 
@@ -161,17 +161,21 @@ public class Uniprot extends DbSourceProxyImpl
       queries = queries.toUpperCase().replaceAll(
               "(UNIPROT\\|?|UNIPROT_|UNIREF\\d+_|UNIREF\\d+\\|?)", "");
       AlignmentI al = null;
-      EBIFetchClient ebi = new EBIFetchClient();
-      // uniprotxml parameter required since december 2007
-      // uniprotkb dbname changed introduced december 2008
-      File file = ebi.fetchDataAsFile("uniprotkb:" + queries, "uniprotxml",
-              "xml");
+
+      String downloadstring = "http://www.uniprot.org/uniprot/" + queries
+              + ".xml";
+      URL url = null;
+      URLConnection urlconn = null;
+
+      url = new URL(downloadstring);
+      urlconn = url.openConnection();
+      InputStream istr = urlconn.getInputStream();
       Vector<UniprotEntry> entries = getUniprotEntries(
-              new FileReader(file));
+              new InputStreamReader(istr, "UTF-8"));
 
       if (entries != null)
       {
-        ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
+        ArrayList<SequenceI> seqs = new ArrayList<>();
         for (UniprotEntry entry : entries)
         {
           seqs.add(uniprotEntryToSequenceI(entry));
@@ -183,8 +187,10 @@ public class Uniprot extends DbSourceProxyImpl
       return al;
     } catch (Exception e)
     {
-      stopQuery();
       throw (e);
+    } finally
+    {
+      stopQuery();
     }
   }
 
@@ -202,7 +208,7 @@ public class Uniprot extends DbSourceProxyImpl
     sequence.setDescription(getUniprotEntryDescription(entry));
 
     final String dbVersion = getDbVersion();
-    ArrayList<DBRefEntry> dbRefs = new ArrayList<DBRefEntry>();
+    ArrayList<DBRefEntry> dbRefs = new ArrayList<>();
     for (String accessionId : entry.getAccession())
     {
       DBRefEntry dbRef = new DBRefEntry(DBRefSource.UNIPROT, dbVersion,
@@ -212,7 +218,7 @@ public class Uniprot extends DbSourceProxyImpl
       dbRefs.add(dbRef);
     }
 
-    Vector<PDBEntry> onlyPdbEntries = new Vector<PDBEntry>();
+    Vector<PDBEntry> onlyPdbEntries = new Vector<>();
     for (PDBEntry pdb : entry.getDbReference())
     {
       DBRefEntry dbr = new DBRefEntry();
index 3e8c55e..07a9df4 100644 (file)
@@ -29,6 +29,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -205,7 +206,14 @@ public class EBIFetchClient
     {
       URL rcall = new URL(url);
 
-      InputStream is = new BufferedInputStream(rcall.openStream());
+      HttpURLConnection conn = (HttpURLConnection) rcall.openConnection();
+      int responseCode = conn.getResponseCode();
+      if (responseCode != 200)
+      {
+        System.err.println("Warning: response code " + responseCode
+                + " for " + url);
+      }
+      InputStream is = new BufferedInputStream(conn.getInputStream());
       if (outFile != null)
       {
         FileOutputStream fio = new FileOutputStream(outFile);
@@ -267,12 +275,12 @@ public class EBIFetchClient
     if (database.equalsIgnoreCase(DBRefSource.EMBL)
             || database.equalsIgnoreCase(DBRefSource.EMBLCDS))
     {
-      url = "http://www.ebi.ac.uk/ena/data/view/" + ids.toLowerCase()
+      url = "https://www.ebi.ac.uk/ena/data/view/" + ids.toLowerCase()
               + (format != null ? "&" + format : "");
     }
     else
     {
-      url = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/"
+      url = "https://www.ebi.ac.uk/Tools/dbfetch/dbfetch/"
               + database.toLowerCase() + "/" + ids.toLowerCase()
               + (format != null ? "/" + format : "");
     }
index 40737ca..c559966 100644 (file)
@@ -47,33 +47,26 @@ public class EBIFetchClientTest
     /*
      * EMBL
      */
-    assertEquals("http://www.ebi.ac.uk/ena/data/view/x53838&display=xml",
+    assertEquals("https://www.ebi.ac.uk/ena/data/view/x53838&display=xml",
             EBIFetchClient.buildUrl("X53838", "EMBL", "display=xml"));
 
     /*
      * EMBLCDS
      */
-    assertEquals("http://www.ebi.ac.uk/ena/data/view/caa37824&display=xml",
+    assertEquals("https://www.ebi.ac.uk/ena/data/view/caa37824&display=xml",
             EBIFetchClient.buildUrl("CAA37824", "EMBL", "display=xml"));
 
     /*
-     * Uniprot
-     */
-    assertEquals(
-            "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/uniprot/p00340/uniprotxml",
-            EBIFetchClient.buildUrl("P00340", "UNIPROT", "uniprotxml"));
-
-    /*
      * PDB / pdb
      */
-    assertEquals("http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/pdb",
+    assertEquals("https://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/pdb",
             EBIFetchClient.buildUrl("3A6S", "PDB", "pdb"));
 
     /*
      * PDB / mmCIF
      */
     assertEquals(
-            "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/mmCIF",
+            "https://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/mmCIF",
             EBIFetchClient.buildUrl("3A6S", "PDB", "mmCIF"));
   }