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 ; }
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 .