From 9b6ab93792add396f5a4d092c23ba05f681a520a Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 17 Dec 2020 16:31:10 +0000 Subject: [PATCH] JAL-3690 patch out use of java.streams/spliterator not supported in java2script (yet) --- src/jalview/ws/slivkaws/SlivkaWSInstance.java | 32 ++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) 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; -- 1.7.10.2