You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2023/09/28 19:44:09 UTC

[incubator-baremaps] 08/35: Fix NoSuchElementException in workflow executor

This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch 745-daylight
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit 7d38ad35fb3c3a3239bd8a17b83e09fc5b21f413
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Mon Aug 28 13:51:34 2023 +0200

    Fix NoSuchElementException in workflow executor
---
 .../main/java/org/apache/baremaps/workflow/WorkflowExecutor.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java
index 2b3d3d05..6e0a1a77 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java
@@ -208,13 +208,13 @@ public class WorkflowExecutor implements AutoCloseable {
     var workflowStart = stepMeasures.stream()
         .mapToLong(measures -> measures.stepMeasures.stream()
             .mapToLong(measure -> measure.start)
-            .min().getAsLong())
-        .min().getAsLong();
+            .min().orElseGet(() -> 0L))
+        .min().orElseGet(() -> 0L);
     var workflowEnd = stepMeasures.stream()
         .mapToLong(measures -> measures.stepMeasures.stream()
             .mapToLong(measure -> measure.end)
-            .max().getAsLong())
-        .max().getAsLong();
+            .max().orElseGet(() -> 0L))
+        .max().orElseGet(() -> 0L);
     var workflowDuration = Duration.ofMillis(workflowEnd - workflowStart);
     logger.info("Workflow graph: {}", this.graph);
     logger.info("  Duration: {}", formatDuration(workflowDuration));