catch NameNotFoundException to return false as we check a group existence

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1433977 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-01-16 15:16:28 +00:00
parent a02fa42251
commit 1222b2b217
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration; import javax.naming.NamingEnumeration;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.naming.directory.Attribute; import javax.naming.directory.Attribute;
@ -205,6 +206,11 @@ public class DefaultLdapRoleMapper
return namingEnumeration.hasMore(); return namingEnumeration.hasMore();
} }
catch ( NameNotFoundException e )
{
log.debug( "group {} for role {} not found", groupName, roleName );
return false;
}
catch ( LdapException e ) catch ( LdapException e )
{ {
throw new MappingException( e.getMessage(), e ); throw new MappingException( e.getMessage(), e );