Skip to content

Commit

Permalink
Revert "OF-867 Wrong key in groupMetaCache evict"
Browse files Browse the repository at this point in the history
This reverts commit ffe14c9 and hopefully resolves OF-1263 and OF-1269
  • Loading branch information
akrherz committed Feb 24, 2017
1 parent 0994a25 commit e1ce54a
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions src/java/org/jivesoftware/openfire/group/GroupManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ public void memberAdded(Group group, Map params) {

// Remove only the collection of groups the member belongs to.
String member = (String) params.get("member");
evictCachedUserForGroup(member);
if(member != null) {
groupMetaCache.remove(member);
}
}

@Override
Expand All @@ -186,7 +188,9 @@ public void memberRemoved(Group group, Map params) {

// Remove only the collection of groups the member belongs to.
String member = (String) params.get("member");
evictCachedUserForGroup(member);
if(member != null) {
groupMetaCache.remove(member);
}
}

@Override
Expand All @@ -197,7 +201,9 @@ public void adminAdded(Group group, Map params) {

// Remove only the collection of groups the member belongs to.
String member = (String) params.get("admin");
evictCachedUserForGroup(member);
if(member != null) {
groupMetaCache.remove(member);
}
}

@Override
Expand All @@ -208,20 +214,11 @@ public void adminRemoved(Group group, Map params) {

// Remove only the collection of groups the member belongs to.
String member = (String) params.get("admin");
evictCachedUserForGroup(member);
if(member != null) {
groupMetaCache.remove(member);
}
}

private void evictCachedUserForGroup(String user) {
if(user != null) {
JID userJid = new JID(user);
if (XMPPServer.getInstance().isLocal(userJid)) {
String username = userJid.getNode();
synchronized (username.intern()) {
groupMetaCache.remove(username);
}
}
}
}
});

UserEventDispatcher.addListener(new UserEventListener() {
Expand Down Expand Up @@ -590,7 +587,7 @@ public Collection<Group> getGroups(User user) {
* @return all groups that an entity belongs to.
*/
public Collection<Group> getGroups(JID user) {
String key = user.getNode();
String key = user.toBareJID();

Collection<String> groupNames = (Collection<String>)groupMetaCache.get(key);
if (groupNames == null) {
Expand Down

0 comments on commit e1ce54a

Please sign in to comment.