From 740b7bebae6f5cfbcd5834e1238e53c665611a8c Mon Sep 17 00:00:00 2001 From: Denis Nikiforov Date: Sat, 16 Nov 2024 10:35:25 +0300 Subject: [PATCH] [4204] Prevent the changeDescriptionSink from crashing because of the related representation refresh Bug: https://github.com/eclipse-sirius/sirius-web/issues/4204 Signed-off-by: Denis Nikiforov --- CHANGELOG.adoc | 1 + .../editingcontext/EditingContextEventProcessor.java | 12 ++++++------ .../sirius/components/interpreter/Result.java | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 40bb582ebe0..07bb6c78d77 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -59,6 +59,7 @@ This provider is in charge of getting the icon list of the representation. This was first fixed in 2022.3.0 but broken in 2024.3.0; it is now fixed again. - https://github.com/eclipse-sirius/sirius-web/issues/4280[#4280] [diagram] Fix direct edit with F2 when the palette is opened - https://github.com/eclipse-sirius/sirius-web/issues/4302[#4302] [diagram] Fix edges label flashing +- https://github.com/eclipse-sirius/sirius-web/issues/4204[#4204] [core] Prevent the changeDescriptionSink from crashing because of the related representation refresh === New Features diff --git a/packages/core/backend/sirius-components-collaborative/src/main/java/org/eclipse/sirius/components/collaborative/editingcontext/EditingContextEventProcessor.java b/packages/core/backend/sirius-components-collaborative/src/main/java/org/eclipse/sirius/components/collaborative/editingcontext/EditingContextEventProcessor.java index b9eed4fd783..2537ca5c8a2 100644 --- a/packages/core/backend/sirius-components-collaborative/src/main/java/org/eclipse/sirius/components/collaborative/editingcontext/EditingContextEventProcessor.java +++ b/packages/core/backend/sirius-components-collaborative/src/main/java/org/eclipse/sirius/components/collaborative/editingcontext/EditingContextEventProcessor.java @@ -157,18 +157,18 @@ private Disposable setupChangeDescriptionSinkConsumer() { var refreshRepresentationSample = Timer.start(this.meterRegistry); - RepresentationEventProcessorEntry representationEventProcessorEntry = this.representationEventProcessors.get(changeDescription.getSourceId()); - if (representationEventProcessorEntry != null) { - try { + try { + RepresentationEventProcessorEntry representationEventProcessorEntry = this.representationEventProcessors.get(changeDescription.getSourceId()); + if (representationEventProcessorEntry != null) { IRepresentationEventProcessor representationEventProcessor = representationEventProcessorEntry.getRepresentationEventProcessor(); representationEventProcessor.refresh(changeDescription); IRepresentation representation = representationEventProcessor.getRepresentation(); this.applicationEventPublisher.publishEvent(new RepresentationRefreshedEvent(this.editingContext.getId(), representation)); - } catch (Exception exception) { - this.logger.warn(exception.getMessage(), exception); } + this.refreshOtherRepresentations(changeDescription); + } catch (Exception exception) { + this.logger.warn(exception.getMessage(), exception); } - this.refreshOtherRepresentations(changeDescription); var timer = this.meterRegistry.timer(Monitoring.TIMER_REFRESH_REPRESENTATION, "changeDescription", changeDescription.getSourceId()); refreshRepresentationSample.stop(timer); diff --git a/packages/emf/backend/sirius-components-interpreter/src/main/java/org/eclipse/sirius/components/interpreter/Result.java b/packages/emf/backend/sirius-components-interpreter/src/main/java/org/eclipse/sirius/components/interpreter/Result.java index b452eeac51c..21a9d69b119 100644 --- a/packages/emf/backend/sirius-components-interpreter/src/main/java/org/eclipse/sirius/components/interpreter/Result.java +++ b/packages/emf/backend/sirius-components-interpreter/src/main/java/org/eclipse/sirius/components/interpreter/Result.java @@ -147,6 +147,6 @@ public Optional asBoolean() { @Override public String toString() { - return MessageFormat.format("Result { status: {0}, rawValue: {1}}", this.status, this.rawValue); + return MessageFormat.format("Result '{' status: {0}, rawValue: {1} '}'", this.status, this.rawValue); } }