public String getSingleLdapName() throws NamingException {
    List<String> allLdapNames = getAllLdapNames();
    if (allLdapNames.size() == 1) {
      return allLdapNames.get(0);
    }
    throw new NamingException("Single result was expected");
  }
Returns a single entry from the search result.
Throws {@code NamingException} if the search result doesn't contain exactly one entry.
@return name in the namespace
@throws NamingException
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ldap/SearchResultHandler.java