Skip to content

Commit

Permalink
[BUG] 🐛 Hotfix connection pooling created though already exists decor…
Browse files Browse the repository at this point in the history
…ator

Signed-off-by: Antoine Brunetti <[email protected]>
  • Loading branch information
antoine-brunetti authored and CChemin committed Nov 17, 2023
1 parent 1e28669 commit 2881589
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ private Object transformLdapResponseToValue(
}

private LDAPConnectionPool getConnectionByHost(String host, int port) throws LDAPException {
ldapConnectionByHost.putIfAbsent(host + "_" + port, createHostConnection(host, port));
if (!ldapConnectionByHost.containsKey(host + "_" + port)) {
ldapConnectionByHost.put(host + "_" + port, createHostConnection(host, port));
}
return ldapConnectionByHost.get(host + "_" + port);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class LdapSeeAlsoDecoratorBadAuthentTest {
public void requestWithBadCredentialsShouldFail() {
Object res =
ldapSeeAlsoDecorator.getResourceFromUrl(
"ldap://localhost:10389/uid=testc,ou=contacts,ou=clients_domaine1,o=insee,c=fr", "cn");
"ldap://localhost:10389/uid=testc,ou=contacts,ou=clients_domaine2,o=insee,c=fr", "cn");
assertThat("Resource should be null", res, is(nullValue()));
}
}

0 comments on commit 2881589

Please sign in to comment.