Fix catching NameAlreadyBoundException

Closes #29142

Signed-off-by: Robin Meese <39960884+robson90@users.noreply.github.com>
This commit is contained in:
Robin Meese 2024-05-02 15:12:56 +02:00 committed by Pedro Igor
parent e93b7d4f3a
commit 8a5fb8337b

View file

@ -17,6 +17,7 @@
package org.keycloak.storage.ldap.idm.store.ldap; package org.keycloak.storage.ldap.idm.store.ldap;
import javax.naming.NameAlreadyBoundException;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.keycloak.common.util.Base64; import org.keycloak.common.util.Base64;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
@ -116,7 +117,7 @@ public class LDAPIdentityStore implements IdentityStore {
ModificationItem item = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); ModificationItem item = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr);
try { try {
this.operationManager.modifyAttributesNaming(groupDn, new ModificationItem[]{item}, null); this.operationManager.modifyAttributesNaming(groupDn, new ModificationItem[]{item}, null);
} catch (AttributeInUseException e) { } catch (AttributeInUseException | NameAlreadyBoundException e) {
logger.debugf("Group %s already contains the member %s", groupDn, value); logger.debugf("Group %s already contains the member %s", groupDn, value);
} catch (NamingException e) { } catch (NamingException e) {
throw new ModelException("Could not modify attribute for DN [" + groupDn + "]", e); throw new ModelException("Could not modify attribute for DN [" + groupDn + "]", e);