private Vector getAttribute(String entryDN, String attr) {
    Vector v = new Vector();
    LDAPSearchResults searchResults;
    LDAPEntry entry = null;
    try {
      searchResults = connection.search(entryDN, LDAPConnection.SCOPE_BASE, "", null, false);
      entry = searchResults.next();
    } catch (LDAPException e) {
      // e.printStackTrace();
      return v;
    }

    // System.out.println(entry);
    LDAPAttributeSet attributeSet = entry.getAttributeSet();
    // System.out.println(attributeSet);
    Iterator allAttributes = attributeSet.iterator();

    while (allAttributes.hasNext()) {
      LDAPAttribute attribute = (LDAPAttribute) allAttributes.next();
      String attributeName = attribute.getName();
      if (attributeName.equalsIgnoreCase(attr)) {
        Enumeration en = attribute.getStringValues();
        for (; en.hasMoreElements(); ) {
          v.add(en.nextElement());
        }
      }
    }
    return v;
  }
  /**
   * Gives the members, in the ldap, that are corresponding to the logic definition of a group.
   *
   * @param definition The logic definition of the members of the group.
   * @return The set of the members ids.
   * @see
   *     org.esco.dynamicgroups.dao.ldap.IMembersFromDefinitionDAO#getMembers(DynamicGroupDefinition)
   */
  public Set<String> getMembers(final DynamicGroupDefinition definition) {
    final Set<String> userIds = new HashSet<String>();
    if (definition.isValid()) {
      checkConnection();

      final String filter = translateToLdapFilter(definition);

      try {
        final LDAPSearchResults result =
            getConnection()
                .search(
                    ldapParameters.getLdapSearchBase(),
                    LDAPConnection.SCOPE_SUB,
                    filter,
                    uidAttributeArray,
                    false,
                    constraints);

        while (result.hasMore()) {
          final LDAPEntry entry = result.next();
          userIds.add(entry.getAttribute(ldapParameters.getLdapUidAttribute()).getStringValue());
        }

      } catch (LDAPException e) {
        LOGGER.error(
            "Error while trying to retrieve the members for the definition: "
                + definition
                + " - associated filter: "
                + filter);
        LOGGER.error(e, e);
        final String filter2 = translateToLdapFilter(definition);
        LOGGER.error("!!! Remove this message : " + filter2);
      }
    }
    return userIds;
  }