JAL-3690 patch out use of java.streams/spliterator not supported in java2script ...
authorJim Procter <jprocter@issues.jalview.org>
Thu, 17 Dec 2020 16:31:10 +0000 (16:31 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 17 Dec 2020 16:31:10 +0000 (16:31 +0000)
src/jalview/ws/slivkaws/SlivkaWSInstance.java

index 33c1205..978d775 100644 (file)
@@ -129,13 +129,20 @@ public abstract class SlivkaWSInstance extends ServiceWithParameters
   public final boolean updateJobProgress(WsJob job) throws IOException
   {
     List<RemoteFile> files = client.getJobResults(job.getJobId());
-    Optional<RemoteFile> logFile = files.stream()
-            .filter(f -> f.getLabel().equals("log")).findFirst();
+    RemoteFile logFile=null;
+    for (RemoteFile f : files)
+    {
+      if (f.getLabel().equals("log"))
+      {
+        logFile = f; break;
+      }
+    }
+
     boolean newContent = false;
-    if (logFile.isPresent())
+    if (logFile!=null)
     {
       ByteArrayOutputStream output = new ByteArrayOutputStream();
-      logFile.get().writeTo(output);
+      logFile.writeTo(output);
       if (output.size() > job.getNextChunk())
       {
         newContent = true;
@@ -145,12 +152,21 @@ public abstract class SlivkaWSInstance extends ServiceWithParameters
     }
     if (failedStates.contains(job.getJobState()))
     {
-      Optional<RemoteFile> errLogFile = files.stream()
-              .filter(f -> f.getLabel().equals("error-log")).findFirst();
-      if (errLogFile.isPresent())
+      
+      RemoteFile errLogFile = null;
+      for (RemoteFile f : files)
+      {
+        if (f.getLabel().equals("error-log"))
+        {
+          errLogFile = f;
+          break;
+        }
+      }
+
+      if (errLogFile!=null)
       {
         ByteArrayOutputStream output = new ByteArrayOutputStream();
-        errLogFile.get().writeTo(output);
+        errLogFile.writeTo(output);
         if (output.size() > 0)
         {
           newContent = true;