@@ -81,6 +81,7 @@ public LdapConfigurationResponse addConfiguration(final String hostname, final i
8181 s_logger .info ("Added new ldap server with hostname: " + hostname );
8282 return new LdapConfigurationResponse (hostname , port );
8383 } catch (final NamingException e ) {
84+ s_logger .debug ("NamingException while doing an LDAP bind" , e );
8485 throw new InvalidParameterValueException ("Unable to bind to the given LDAP server" );
8586 }
8687 } else {
@@ -98,6 +99,7 @@ public boolean canAuthenticate(final String username, final String password) {
9899 closeContext (context );
99100 return true ;
100101 } catch (final NamingException e ) {
102+ s_logger .debug ("NamingException: while doing an LDAP bind for user " +" " +username , e );
101103 s_logger .info ("Failed to authenticate user: " + username + ". incorrect password." );
102104 return false ;
103105 }
@@ -109,7 +111,7 @@ private void closeContext(final DirContext context) {
109111 context .close ();
110112 }
111113 } catch (final NamingException e ) {
112- s_logger .warn (e .getMessage ());
114+ s_logger .warn (e .getMessage (), e );
113115 }
114116 }
115117
@@ -183,6 +185,7 @@ public List<LdapUser> getUsers() throws NoLdapUserMatchingQueryException {
183185 context = _ldapContextFactory .createBindContext ();
184186 return _ldapUserManager .getUsers (context );
185187 } catch (final NamingException e ) {
188+ s_logger .debug ("ldap NamingException: " ,e );
186189 throw new NoLdapUserMatchingQueryException ("*" );
187190 } finally {
188191 closeContext (context );
@@ -196,6 +199,7 @@ public List<LdapUser> getUsersInGroup(String groupName) throws NoLdapUserMatchin
196199 context = _ldapContextFactory .createBindContext ();
197200 return _ldapUserManager .getUsersInGroup (groupName , context );
198201 } catch (final NamingException e ) {
202+ s_logger .debug ("ldap NamingException: " ,e );
199203 throw new NoLdapUserMatchingQueryException ("groupName=" + groupName );
200204 } finally {
201205 closeContext (context );
@@ -223,6 +227,7 @@ public List<LdapUser> searchUsers(final String username) throws NoLdapUserMatchi
223227 final String escapedUsername = LdapUtils .escapeLDAPSearchFilter (username );
224228 return _ldapUserManager .getUsers ("*" + escapedUsername + "*" , context );
225229 } catch (final NamingException e ) {
230+ s_logger .debug ("ldap NamingException: " ,e );
226231 throw new NoLdapUserMatchingQueryException (username );
227232 } finally {
228233 closeContext (context );
0 commit comments