JAL-4236 don’t look for headers in JalviewJS
authorJames Procter <j.procter@dundee.ac.uk>
Mon, 13 Nov 2023 17:19:11 +0000 (17:19 +0000)
committerJames Procter <j.procter@dundee.ac.uk>
Mon, 13 Nov 2023 17:19:11 +0000 (17:19 +0000)
src/jalview/fts/service/uniprot/UniProtFTSRestClient.java

index 980dac6..f5e98bd 100644 (file)
@@ -227,18 +227,22 @@ public class UniProtFTSRestClient extends FTSRestClient
         throw new Exception(errorMessage);
 
       }
-      // new Uniprot API is not including a "X-Total-Results" header when there
-      // are 0 results
-      List<String> resultsHeaders = clientResponse.getHeaders()
-              .get("X-Total-Results");
       int xTotalResults = 0;
       if (Platform.isJS())
       {
         xTotalResults = 1;
       }
-      else if (resultsHeaders != null && resultsHeaders.size() >= 1)
+      else
       {
-        xTotalResults = Integer.valueOf(resultsHeaders.get(0));
+        // new Uniprot API is not including a "X-Total-Results" header when
+        // there
+        // are 0 results
+        List<String> resultsHeaders = clientResponse.getHeaders()
+                .get("X-Total-Results");
+        if (resultsHeaders != null && resultsHeaders.size() >= 1)
+        {
+          xTotalResults = Integer.valueOf(resultsHeaders.get(0));
+        }
       }
       clientResponse = null;
       client = null;