fixed a possible race condition (INFRADNA-65)

Originally-Committed-As: a9efb3dac2363331e577b08cbd876f890df303f3
This commit is contained in:
Kohsuke Kawaguchi 2011-02-18 10:34:46 -08:00
parent baec8a9e47
commit 7697934967

View file

@ -436,10 +436,12 @@ public class LDAPSecurityRealm extends AbstractPasswordBasedSecurityRealm {
// intern attributes
Attributes v = ldapUser.getAttributes();
if (v instanceof BasicAttributes) {// BasicAttributes.equals is what makes the interning possible
synchronized (attributesCache) {
Attributes vv = (Attributes)attributesCache.get(v);
if (vv==null) attributesCache.put(v,vv=v);
user.setAttributes(vv);
}
}
GrantedAuthority[] extraAuthorities = authoritiesPopulator.getGrantedAuthorities(ldapUser);
for (GrantedAuthority extraAuthority : extraAuthorities) {