This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-3799 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 9a549f0105db820f0e7d746a365850bb764409b8 Author: Dan Haywood <[email protected]> AuthorDate: Thu Jun 27 14:47:12 2024 +0100 CAUSEWAY-3799: ensures Can of Property changes holds only unique values --- .../java/org/apache/causeway/commons/collections/Can_Multiple.java | 2 +- .../publish/EntityPropertyChangePublisherDefault.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java index 320a571631..895ea2e49c 100644 --- a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java +++ b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java @@ -436,7 +436,7 @@ final class Can_Multiple<T> implements Can<T> { @Override public Set<T> toSet() { val set = _Sets.<T>newHashSet(); // serializable - elements.forEach(set::add); + set.addAll(elements); return Collections.unmodifiableSet(set); // serializable and immutable } diff --git a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/publish/EntityPropertyChangePublisherDefault.java b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/publish/EntityPropertyChangePublisherDefault.java index 4e797193ec..a6a6d565ec 100644 --- a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/publish/EntityPropertyChangePublisherDefault.java +++ b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/publish/EntityPropertyChangePublisherDefault.java @@ -19,6 +19,7 @@ package org.apache.causeway.core.runtimeservices.publish; import java.util.List; +import java.util.stream.Collectors; import javax.annotation.PostConstruct; import javax.annotation.Priority; @@ -98,7 +99,10 @@ public class EntityPropertyChangePublisherDefault implements EntityPropertyChang val propertyChanges = hasEnlistedEntityPropertyChanges().getPropertyChanges( currentTime, currentUser, - currentTransactionId); + currentTransactionId) + .toSet() // ensure uniqueness + .stream() + .collect(Can.toCan()); XrayUtil.SequenceHandle xrayHandle = null; try {
