JAL-4036 moved a comment block
[jalview.git] / src / jalview / fts / service / uniprot / UniProtFTSRestClient.java
index 05ccba7..1827293 100644 (file)
  * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 
-/*
- * 2022-07-20 bsoares
- * See https://issues.jalview.org/browse/JAL-4036
- * The new Uniprot API is not dissimilar to the old one, but has some important changes.
- * Some group names have changed slightly, some old groups have gone and there are quite a few new groups.
- * 
- * Most changes are mappings of old column ids to new field ids. There are a handful of old
- * columns not mapped to new fields, and new fields without an old column.
- * [aside: not all possible columns were listed in the resources/fts/uniprot_data_columns.txt file.
- * These were presumably additions after the file was created]
- * For existing/mapped fields, the same preferences found in the resource file have been migrated to
- * the new file with the new field name, id and group.
- * 
- * The new mapped groups and files are stored and read from resources/fts/uniprot_data_columns-2022.txt.
- * 
- * There is now no "sort" query string parameter.
- * 
- * See https://www.uniprot.org/help/api_queries
- * 
- * SIGNIFICANT CHANGE: Pagination is no longer performed using a record offset, but with a "cursor"
- * query string parameter that is not really a cursor.  The value is an opaque string that is passed (or
- * rather a whole URL is passed) in the "Link" header of the HTTP response of the previous page.
- * Where such a link is passed it is put into the cursors ArrayList.
- * There are @Overridden methods in UniprotFTSPanel.
- */
-
 package jalview.fts.service.uniprot;
 
 import java.lang.invoke.MethodHandles;
@@ -73,6 +47,32 @@ import jalview.util.ChannelProperties;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
 
+/*
+ * 2022-07-20 bsoares
+ * See https://issues.jalview.org/browse/JAL-4036
+ * The new Uniprot API is not dissimilar to the old one, but has some important changes.
+ * Some group names have changed slightly, some old groups have gone and there are quite a few new groups.
+ * 
+ * Most changes are mappings of old column ids to new field ids. There are a handful of old
+ * columns not mapped to new fields, and new fields without an old column.
+ * [aside: not all possible columns were listed in the resources/fts/uniprot_data_columns.txt file.
+ * These were presumably additions after the file was created]
+ * For existing/mapped fields, the same preferences found in the resource file have been migrated to
+ * the new file with the new field name, id and group.
+ * 
+ * The new mapped groups and files are stored and read from resources/fts/uniprot_data_columns-2022.txt.
+ * 
+ * There is now no "sort" query string parameter.
+ * 
+ * See https://www.uniprot.org/help/api_queries
+ * 
+ * SIGNIFICANT CHANGE: Pagination is no longer performed using a record offset, but with a "cursor"
+ * query string parameter that is not really a cursor.  The value is an opaque string that is passed (or
+ * rather a whole URL is passed) in the "Link" header of the HTTP response of the previous page.
+ * Where such a link is passed it is put into the cursors ArrayList.
+ * There are @Overridden methods in UniprotFTSPanel.
+ */
+
 public class UniProtFTSRestClient extends FTSRestClient
 {
   private static final String DEFAULT_UNIPROT_DOMAIN = "https://rest.uniprot.org";
@@ -95,7 +95,7 @@ public class UniProtFTSRestClient extends FTSRestClient
   {
     super();
     this.clearCursors();
-    uniprotSearchEndpoint = Cache.getDefault("UNIPROT_DOMAIN",
+    uniprotSearchEndpoint = Cache.getDefault("UNIPROT_2022_DOMAIN",
             DEFAULT_UNIPROT_DOMAIN) + "/uniprotkb/search";
   }
 
@@ -247,7 +247,8 @@ public class UniProtFTSRestClient extends FTSRestClient
               uniprotRestRequest, xTotalResults);
     } catch (Exception e)
     {
-      Console.debug("Exception caught from response", e);
+      Console.warn("Problem with the query: " + e.getMessage());
+      Console.debug("Exception stacktrace:", e);
       String exceptionMsg = e.getMessage();
       if (exceptionMsg.contains("SocketException"))
       {
@@ -545,8 +546,7 @@ public class UniProtFTSRestClient extends FTSRestClient
       }
     } catch (MalformedURLException e)
     {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
+      Console.warn("Could not obtain next page 'cursor' value from 'u");
     }
     return null;
   }