This is an automated email from the ASF dual-hosted git repository. cschneider pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/aries-rsa.git
The following commit(s) were added to refs/heads/master by this push: new c73cd37 Two inconsistency introduced with ARIES-1941: (#34) c73cd37 is described below commit c73cd3764676e4234ef0d00339cea45afe0df754 Author: Arnoud Glimmerveen <arn...@glimmerveen.org> AuthorDate: Sun Nov 10 12:50:41 2019 +0100 Two inconsistency introduced with ARIES-1941: (#34) 1) The copy of the keySet was incorrectly removed by 927d0b3, and is needed regardless of the external methods being thread-safe. 2) Clear method of MultiMap must use the same mutex as the other public methods. --- .../org/apache/aries/rsa/topologymanager/importer/MultiMap.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java index b0f8dbe..37cbcf7 100644 --- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java +++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java @@ -65,12 +65,14 @@ public class MultiMap<T> { } public synchronized void remove(T toRemove) { - for (String key : map.keySet()) { + // Use copy of keySet, as subsequent remove may modify the keySet itself + Set<String> keys = new HashSet<>(map.keySet()); + for (String key : keys) { remove(key, toRemove); } } - public void clear() { + public synchronized void clear() { map.clear(); } }