From da2c6054046cad8df78fbbf6a8050a92b8069bc3 Mon Sep 17 00:00:00 2001 From: Vaadin Bot Date: Mon, 16 May 2022 12:58:52 +0200 Subject: [PATCH] fix: Ignore CancellationException for running UI update tasks (#13708) (#13766) Ignore CancellationException if the task is cancelled in the meantime. Authored-by: @HawkSK Fixes #13610 Co-authored-by: @mshabarov Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com> --- .../src/main/java/com/vaadin/flow/server/VaadinService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java b/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java index 237fae75531..458ff2dda0a 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java @@ -42,6 +42,7 @@ import java.util.Optional; import java.util.ServiceLoader; import java.util.Set; +import java.util.concurrent.CancellationException; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Future; @@ -2063,6 +2064,10 @@ public void runPendingAccessTasks(VaadinSession session) { try { pendingAccess.get(); + } catch (CancellationException ignored) { // NOSONAR + // Ignore canceled UI access tasks exceptions and don't + // let it to be processed by the error handler and shown + // on the UI } catch (Exception exception) { pendingAccess.handleError(exception); }