X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fws%2Febi%2FEBIFetchClient.java;h=07a9df4b5cff7ecd6e8866fafd2b38b393ab863f;hb=c78840385a5ac9dd6d16a37aa7b55cfaeb360456;hp=3e8c55ed621b8f9d3a60c1d3f81911122211b139;hpb=48f7c55f44b0526c5f7be8ebf986052ca7dae245;p=jalview.git diff --git a/src/jalview/ws/ebi/EBIFetchClient.java b/src/jalview/ws/ebi/EBIFetchClient.java index 3e8c55e..07a9df4 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.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 : ""); }