@NotNull private LdapConnection connect() throws ExternalIdentityException { try { if (adminPool == null) { return adminConnectionFactory.makeObject(); } else { return adminPool.getConnection(); } } catch (Exception e) { String msg = "Error while connecting to the ldap server."; log.error(msg, e); throw new ExternalIdentityException(msg, e); } }