code: public String getAttrStr(String attr) throws NamingException {
      Object o = getAttrVal(attr);
  
      if (o == null) {
        return null;
      }
  
      if (o instanceof String) {
        return (String)o;
      }
  
      return o.toString();
    }
docs: getAttrStr - return first (or only) string value for given attribute
  
  @param   attr   String attribute name
  @return  String attribute value
  @throws NamingException