From 222a3be52fccf788b1f9c7d674f473022888cb70 Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Tue, 22 Jan 2013 11:08:39 +0000 Subject: [PATCH] Fix bug: remove outdated email key from map when calling addOrUpdateUser() with new email address. SVN: 28147 --- .../cisd/authentication/file/LineBasedUserStore.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/authentication/source/java/ch/systemsx/cisd/authentication/file/LineBasedUserStore.java b/authentication/source/java/ch/systemsx/cisd/authentication/file/LineBasedUserStore.java index 523c8f9f703..02335a9a11c 100644 --- a/authentication/source/java/ch/systemsx/cisd/authentication/file/LineBasedUserStore.java +++ b/authentication/source/java/ch/systemsx/cisd/authentication/file/LineBasedUserStore.java @@ -160,7 +160,11 @@ final class LineBasedUserStore<T extends UserEntry> implements IUserStore<T> assert user != null; updateMaps(); - idToEntryMap.put(user.getUserId(), user); + final T oldUserOrNull = idToEntryMap.put(user.getUserId(), user); + if (oldUserOrNull != null && StringUtils.isNotBlank(oldUserOrNull.getEmail())) + { + emailToEntryMap.remove(oldUserOrNull.getEmail().toLowerCase()); + } if (StringUtils.isNotBlank(user.getEmail())) { if (emailToEntryMap.put(user.getEmail().toLowerCase(), user) != null) -- GitLab