From e60cc5ef2185356035706a6b7130a4c697674188 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 28 Sep 2016 07:52:08 +0100 Subject: [PATCH] JAL-2210 JAL-2232 check response code before attempting to get the content to avoid IO error raised for HTTP 400 --- src/jalview/ext/ensembl/EnsemblRestClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jalview/ext/ensembl/EnsemblRestClient.java b/src/jalview/ext/ensembl/EnsemblRestClient.java index 72efdc1..f8cd0d6 100644 --- a/src/jalview/ext/ensembl/EnsemblRestClient.java +++ b/src/jalview/ext/ensembl/EnsemblRestClient.java @@ -248,7 +248,6 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher writePostBody(connection, ids); } - InputStream response = connection.getInputStream(); int responseCode = connection.getResponseCode(); if (responseCode != 200) @@ -261,6 +260,9 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher "Response code was not 200. Detected response was " + responseCode); } + // get content + InputStream response = connection.getInputStream(); + // System.out.println(getClass().getName() + " took " // + (System.currentTimeMillis() - now) + "ms to fetch"); -- 1.7.10.2