private String getAttributeValue(Attributes attrs, int attribute) throws NamingException {
        NamingEnumeration values = null;
        String aValue = "";
        if (!isAttribute(attribute)) return aValue;
        Attribute attrib = attrs.get(attributes[attribute]);
        if (attrib != null) {
            for (values = attrib.getAll(); values.hasMoreElements(); ) {
                aValue = (String) values.nextElement();
                break; // take only the first attribute value
            }
        }
        return aValue;
    }
private String getAttributeValue ( Attributes attrs , int attribute ) throws NamingException { NamingEnumeration values = null ; String aValue = "" ; if ( ! isAttribute ( attribute ) ) return aValue ; Attribute attrib = attrs . get ( attributes [ attribute ] ) ; if ( attrib != null ) { for ( values = attrib . getAll ( ) ; values . hasMoreElements ( ) ; ) { aValue = ( String ) values . nextElement ( ) ; break ; } } return aValue ; }
Return a single value of an attribute from possibly multiple values, grossly ignoring
anything else. If there are no values, then return an empty string.

@param attrs LDAP query results
@param attribute LDAP attribute we are interested in
@return a single value of the attribute