From c8072aba53c02652c71bbd9c8e694a52577965d2 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Fri, 4 Aug 2017 23:52:31 +0300 Subject: [PATCH 1/1] Fixed CommandContextImpl.merge to not duplicate same values in result According to Antti this was a known and very old problem that should now finally be resolved. refs #7409 Change-Id: I0ab43d7136fca3f3333a81751fc86e0da7085a26 (cherry picked from commit c09116b855b4bb4a377be1c573ddbb5d755c0bc1) --- .../simantics/document/server/io/CommandContextImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/CommandContextImpl.java b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/CommandContextImpl.java index 5b49810fa..5fb3a283e 100644 --- a/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/CommandContextImpl.java +++ b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/CommandContextImpl.java @@ -66,6 +66,12 @@ public class CommandContextImpl implements CommandContextMutable { if (context != null) { Map>> from = context.getData(); for (Map.Entry>> entry : from.entrySet()) { + String key = entry.getKey(); + Object existing = getValue(key); + Object newValue = context.getValue(key); + // Do not merge duplicates! + if (newValue != null && newValue.equals(existing)) + continue; List> rows = ensureRowsAvailable(entry.getKey()); rows.addAll(entry.getValue()); } -- 2.43.2