From fd97f5ba0b46671b9dcf4ed9ac3da500b9057e80 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 10 May 2018 20:18:48 +0200 Subject: [PATCH] Use a CopyOnWriteArraySet for joinedRooms Since it is accessed concurrently. And also may cause a ConcurrentModificationException when the MultiUserChatManager tries to re-join the joined rooms. Fixes SMACK-819. --- .../org/jivesoftware/smackx/muc/MultiUserChatManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java index c88b64e3a..a627ada6a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java @@ -20,7 +20,6 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -134,7 +133,11 @@ public final class MultiUserChatManager extends Manager { new NotFilter(MessageTypeFilter.ERROR)); private final Set invitationsListeners = new CopyOnWriteArraySet(); - private final Set joinedRooms = new HashSet<>(); + + /** + * The XMPP addresses of currently joined rooms. + */ + private final Set joinedRooms = new CopyOnWriteArraySet<>(); /** * A Map of MUC JIDs to {@link MultiUserChat} instances. We use weak references for the values in order to allow