JAL-2210 JAL-2232 check response code before attempting to get the content to avoid...
authorJim Procter <jprocter@issues.jalview.org>
Wed, 28 Sep 2016 06:52:08 +0000 (07:52 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 28 Sep 2016 06:52:08 +0000 (07:52 +0100)
src/jalview/ext/ensembl/EnsemblRestClient.java

index 72efdc1..f8cd0d6 100644 (file)
@@ -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");