From 504b9bf9450187df0937d8a1be03c3680e739dc9 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 28 Sep 2017 16:51:30 +0100 Subject: [PATCH] JAL-2745 update www.ebi.ac.uk to https --- src/jalview/fts/service/pdb/PDBFTSRestClient.java | 2 +- src/jalview/ws/ebi/EBIFetchClient.java | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/jalview/fts/service/pdb/PDBFTSRestClient.java b/src/jalview/fts/service/pdb/PDBFTSRestClient.java index a483f44..cbeaff1 100644 --- a/src/jalview/fts/service/pdb/PDBFTSRestClient.java +++ b/src/jalview/fts/service/pdb/PDBFTSRestClient.java @@ -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() { diff --git a/src/jalview/ws/ebi/EBIFetchClient.java b/src/jalview/ws/ebi/EBIFetchClient.java index 3e8c55e..50151d9 100644 --- a/src/jalview/ws/ebi/EBIFetchClient.java +++ b/src/jalview/ws/ebi/EBIFetchClient.java @@ -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.out.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 : ""); } -- 1.7.10.2