From: Jim Procter Date: Thu, 17 Dec 2020 16:31:10 +0000 (+0000) Subject: JAL-3690 patch out use of java.streams/spliterator not supported in java2script ... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9b6ab93792add396f5a4d092c23ba05f681a520a;p=jalview.git JAL-3690 patch out use of java.streams/spliterator not supported in java2script (yet) --- diff --git a/src/jalview/ws/slivkaws/SlivkaWSInstance.java b/src/jalview/ws/slivkaws/SlivkaWSInstance.java index 33c1205..978d775 100644 --- a/src/jalview/ws/slivkaws/SlivkaWSInstance.java +++ b/src/jalview/ws/slivkaws/SlivkaWSInstance.java @@ -129,13 +129,20 @@ public abstract class SlivkaWSInstance extends ServiceWithParameters public final boolean updateJobProgress(WsJob job) throws IOException { List files = client.getJobResults(job.getJobId()); - Optional 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 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;