Merge branch 'develop' into update_212_Dec_merge_with_21125_chamges
[jalview.git] / src / jalview / ws / rest / RestJobThread.java
index e397c79..0895f0f 100644 (file)
@@ -20,7 +20,9 @@
  */
 package jalview.ws.rest;
 
-import jalview.bin.Cache;
+import java.util.Locale;
+
+import jalview.bin.Console;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
@@ -260,7 +262,7 @@ public class RestJobThread extends AWSThread
                 + "</a><br>See Console output for details.";
         rj.setAllowedServerExceptions(0);// unrecoverable;
         rj.error = true;
-        Cache.log.fatal("Unexpected REST Job " + getStage(stg)
+        Console.fatal("Unexpected REST Job " + getStage(stg)
                 + "exception for URL " + rj.rsd.postUrl);
         throw (he);
       } catch (IOException e)
@@ -269,7 +271,7 @@ public class RestJobThread extends AWSThread
                 + "Job. <br>Problematic url was <a href=\""
                 + request.getURI() + "\">" + request.getURI()
                 + "</a><br>See Console output for details.";
-        Cache.log.warn("IO Exception for REST Job " + getStage(stg)
+        Console.warn("IO Exception for REST Job " + getStage(stg)
                 + "exception for URL " + rj.rsd.postUrl);
 
         throw (e);
@@ -278,14 +280,12 @@ public class RestJobThread extends AWSThread
       {
       case 200:
         rj.running = false;
-        Cache.log.debug("Processing result set.");
+        Console.debug("Processing result set.");
         processResultSet(rj, response, request);
         break;
-
       case 202:
         markJobAsRunning(rj);
         break;
-
       case 201:
         // Created - redirect may be present. Fallthrough to 302
       case 302:
@@ -300,7 +300,7 @@ public class RestJobThread extends AWSThread
       default:
         // Some other response. Probably need to pop up the content in a window.
         // TODO: deal with all other HTTP response codes from server.
-        Cache.log.warn("Unhandled response status when " + getStage(stg)
+        Console.warn("Unhandled response status when " + getStage(stg)
                 + "for " + postUrl + ": " + response.getStatusLine());
         rj.error = true;
         rj.setAllowedServerExceptions(0);
@@ -314,8 +314,7 @@ public class RestJobThread extends AWSThread
                   + "</a><br/>Filtered response content below:<br/>");
         } catch (IOException e)
         {
-          Cache.log.debug("IOException when consuming unhandled response",
-                  e);
+          Console.debug("IOException when consuming unhandled response", e);
         }
         ;
       }
@@ -368,8 +367,7 @@ public class RestJobThread extends AWSThread
       {
         if (loc.length > 1)
         {
-          Cache.log
-                  .warn("Ignoring additional "
+          Console.warn("Ignoring additional "
                           + (loc.length - 1)
                           + " location(s) provided in response header ( next one is '"
                           + loc[1].getValue() + "' )");
@@ -379,7 +377,6 @@ public class RestJobThread extends AWSThread
       }
     }
   }
-
   /**
    * job has completed. Something valid should be available from con
    * 
@@ -435,7 +432,7 @@ public class RestJobThread extends AWSThread
      */
     String f;
     StringBuffer content = new StringBuffer(f = EntityUtils.toString(en));
-    f = f.toLowerCase();
+    f = f.toLowerCase(Locale.ROOT);
     int body = f.indexOf("<body");
     if (body > -1)
     {
@@ -479,7 +476,7 @@ public class RestJobThread extends AWSThread
     {
       job.setSubjobComplete(true);
       job.setAllowedServerExceptions(-1);
-      Cache.log.error("Exception when trying to start Rest Job.", ex);
+      Console.error("Exception when trying to start Rest Job.", ex);
     }
   }
 
@@ -488,7 +485,7 @@ public class RestJobThread extends AWSThread
   {
     // crazy users will see this message
     // TODO: finish this! and remove the message below!
-    Cache.log.warn("Rest job result parser is currently INCOMPLETE!");
+    Console.warn("Rest job result parser is currently INCOMPLETE!");
     int validres = 0;
     for (RestJob rj : (RestJob[]) jobs)
     {
@@ -497,22 +494,22 @@ public class RestJobThread extends AWSThread
         String ln = null;
         try
         {
-          Cache.log.debug("Parsing data for job " + rj.getJobId());
+          Console.debug("Parsing data for job " + rj.getJobId());
           rj.parseResultSet();
           if (rj.hasResults())
           {
             validres++;
           }
-          Cache.log.debug("Finished parsing data for job " + rj.getJobId());
+          Console.debug("Finished parsing data for job " + rj.getJobId());
 
         } catch (Error ex)
         {
-          Cache.log.warn(
+          Console.warn(
                   "Failed to finish parsing data for job " + rj.getJobId());
           ex.printStackTrace();
         } catch (Exception ex)
         {
-          Cache.log.warn(
+          Console.warn(
                   "Failed to finish parsing data for job " + rj.getJobId());
           ex.printStackTrace();
         } finally
@@ -788,7 +785,7 @@ public class RestJobThread extends AWSThread
               {
                 // TODO: decide if multiple multiple alignments returned by
                 // non-vseparable services are allowed.
-                Cache.log.warn(
+                Console.warn(
                         "dealing with multiple alignment products returned by non-vertically separable service.");
               }
               // recover reference to last alignment created for this rest frame
@@ -902,7 +899,7 @@ public class RestJobThread extends AWSThread
                     }
                     else
                     {
-                      Cache.log.warn(
+                      Console.warn(
                               "Couldn't resolve original sequence for new sequence.");
                     }
                   }
@@ -980,7 +977,7 @@ public class RestJobThread extends AWSThread
                   grass = groupNames.get(alan[nrj][an].groupRef.getName());
                   if (grass == null)
                   {
-                    Cache.log.error(
+                    Console.error(
                             "Couldn't relocate group referemce for group "
                                     + alan[nrj][an].groupRef.getName());
                   }
@@ -1031,7 +1028,7 @@ public class RestJobThread extends AWSThread
               {
                 // TODO: process each newick file, lifting over sequence refs to
                 // current alignment, if necessary.
-                Cache.log.error(
+                Console.error(
                         "Tree recovery from restjob not yet implemented.");
               }
             }
@@ -1071,8 +1068,9 @@ public class RestJobThread extends AWSThread
       HiddenColumns destcs;
       String alTitle = MessageManager
               .formatMessage("label.webservice_job_title_on", new String[]
-              { restClient.service.details.Action,
-                  restClient.service.details.Name, restClient.viewTitle });
+              { restClient.service.details.getAction(),
+                  restClient.service.details.getName(),
+                  restClient.viewTitle });
       switch (action)
       {
       case newAlignment: