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;
}
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;