From c09116b855b4bb4a377be1c573ddbb5d755c0bc1 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Fri, 4 Aug 2017 23:52:31 +0300 Subject: [PATCH] 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 --- .../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 3277bbd1e..995ec0fda 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.47.1