merge from develop
[jalview.git] / src / jalview / ws / dbsources / PDBRestClient.java
index 09c10ef..04c00ec 100644 (file)
@@ -1,5 +1,6 @@
 package jalview.ws.dbsources;
 
+import jalview.util.MessageManager;
 import jalview.ws.uimodel.PDBRestRequest;
 import jalview.ws.uimodel.PDBRestResponse;
 import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary;
@@ -59,7 +60,6 @@ public class PDBRestClient
               .getFieldToSortBy().trim().isEmpty()) ? "" : (pdbRestRequest
               .getFieldToSortBy() + (pdbRestRequest.isAscending() ? " asc"
               : " desc"));
-
       // Build request parameters for the REST Request
       WebResource webResource = client.resource(PDB_SEARCH_ENDPOINT)
               .queryParam("wt", "json").queryParam("fl", wantedFields)
@@ -103,16 +103,17 @@ public class PDBRestClient
       String exceptionMsg = e.getMessage();
       if (exceptionMsg.contains("SocketException"))
       {
-        throw new Exception(
-                "Jalview is unable to detect an internet connection");
         // No internet connection
+        throw new Exception(
+                MessageManager
+                        .getString("exception.unable_to_detect_internet_connection"));
       }
       else if (exceptionMsg.contains("UnknownHostException"))
       {
-        throw new Exception(
-                "Jalview is unable to reach the host server \'www.ebi.ac.uk\'. "
-                        + "\nPlease ensure that you are connected to the internet and try again.");
         // The server 'www.ebi.ac.uk' is unreachable
+        throw new Exception(
+                MessageManager
+                        .getString("exception.pdb_server_unreachable"));
       }
       else
       {
@@ -127,11 +128,12 @@ public class PDBRestClient
     switch (code)
     {
     case 410:
-      message = "PDB Rest Service no longer exists!";
+      message = MessageManager
+              .getString("exception.pdb_rest_service_no_longer_available");
       break;
     case 403:
     case 404:
-      message = "The requested resource could not be found";
+      message = MessageManager.getString("exception.resource_not_be_found");
       break;
     case 408:
     case 409:
@@ -141,7 +143,7 @@ public class PDBRestClient
     case 503:
     case 504:
     case 505:
-      message = "There seems to be an error from the PDB Rest API server.";
+      message = MessageManager.getString("exception.pdb_server_error");
       break;
 
     default: