From: Jim Procter Date: Wed, 28 Sep 2016 06:52:08 +0000 (+0100) Subject: JAL-2210 JAL-2232 check response code before attempting to get the content to avoid... X-Git-Tag: Release_2_10_0~20^2~32 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e60cc5ef2185356035706a6b7130a4c697674188;p=jalview.git JAL-2210 JAL-2232 check response code before attempting to get the content to avoid IO error raised for HTTP 400 --- 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");