propagated use of jalview.util.GapChars for gap removal.
[jalview.git] / src / jalview / ws / MsaWSClient.java
index 4e358a0..36c3823 100755 (executable)
@@ -109,7 +109,7 @@ public class MsaWSClient
         seqarray[i] = new vamsas.objects.simple.Sequence();
         seqarray[i].setId(newname);
         seqarray[i].setSeq((submitGaps) ? msa[i].getSequence()
-                           : AlignSeq.extractGaps("-. ", msa[i].getSequence()));
+                           : AlignSeq.extractGaps(jalview.util.Comparison.GapChars, msa[i].getSequence()));
       }
 
       this.seqs = new vamsas.objects.simple.SequenceSet();
@@ -161,10 +161,10 @@ public class MsaWSClient
         {
           result = server.getResult(jobId);
 
-         if( result.isRunning() )
-           wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);
-         else if( result.isQueued() )
-           wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);
+          if (result.isRunning())
+            wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);
+          else if (result.isQueued())
+            wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);
 
           if (result.isFinished())
           {
@@ -174,28 +174,44 @@ public class MsaWSClient
           }
           else
           {
-            wsInfo.setProgressText(OutputHeader + "\n" + result.getStatus());
+            if (result.getStatus() != null)
+              wsInfo.setProgressText(OutputHeader + "\n" + result.getStatus());
             if (! (result.isJobFailed() || result.isServerError()))
             {
               Thread.sleep(5000);
               //  System.out.println("I'm alive "+seqid+" "+jobid);
             }
+            else
+            {
+              break;
+            }
           }
         }
         catch (Exception ex)
         {
           allowedServerExceptions--;
-          wsInfo.appendProgressText("\n"+ServiceName+" Server exception!\n" + ex.getMessage());
+          wsInfo.appendProgressText("\n" + ServiceName + " Server exception!\n" +
+                                    ex.getMessage());
           ex.printStackTrace();
         }
       }
-
-      if (! (result!=null && (result.isJobFailed() || result.isServerError())))
-        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);
+      if (allowedServerExceptions == 0)
+      {
+        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
+      }
       else
-        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
+      {
+        if (! (result != null && (result.isJobFailed() || result.isServerError())))
+          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);
+        else
+        {
+          if (result.isFailed())
+            wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
+          if (result.isServerError())
+            wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
+        }
+      }
     }
-
     void StartJob()
     {
       try