From 7ea9e78399eb7232501f527bbfba735a660ba77e Mon Sep 17 00:00:00 2001 From: Robin Meese <39960884+robson90@users.noreply.github.com> Date: Thu, 2 May 2024 14:36:58 +0200 Subject: [PATCH] 29142 fix catching NameAlreadyBoundException --- .../storage/ldap/idm/store/ldap/LDAPIdentityStore.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java b/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java index 491278f42455..c33e364f087c 100644 --- a/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java +++ b/federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java @@ -17,6 +17,7 @@ package org.keycloak.storage.ldap.idm.store.ldap; +import javax.naming.NameAlreadyBoundException; import org.jboss.logging.Logger; import org.keycloak.common.util.Base64; import org.keycloak.models.KeycloakSession; @@ -116,7 +117,7 @@ public void addMemberToGroup(LdapName groupDn, String memberAttrName, String val ModificationItem item = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); try { 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); } catch (NamingException e) { throw new ModelException("Could not modify attribute for DN [" + groupDn + "]", e);