private Name getParsedName(Name name) throws NamingException {
    Name result = null;
    if (name instanceof CompositeName) {
      if (name.size() == 0) {
        // Return empty CompositeName
        result = nameParser.parse("");
      } else if (name.size() > 1) {
        throw new InvalidNameException(
            "Multiple name systems are not supported!");
      }
      result = nameParser.parse(name.get(0));
    } else {
      result = (Name) name.clone();
    }
    while (!result.isEmpty()) {
      if (result.get(0).length() == 0) {
        result.remove(0);
        continue;
      }
      if (result.get(result.size() - 1).length() == 0) {
        result.remove(result.size() - 1);
        continue;
      }
      break;
    }
    // Validate that there are not intermediate empty components.
    // Skip first and last element, they are valid
    for (int i = 1; i < result.size() - 1; i++) {
      if (result.get(i).length() == 0) {
        throw new InvalidNameException(
            "Empty intermediate components are not supported!");
      }
    }
    return result;
  }
Parses name which is CompositeName or CompoundName . If name is not CompositeName then it is
assumed to be CompoundName. If the name contains leading and/or terminal empty components, they
will not be included in the result.

@param name Name to parse.
@return parsed name as instance of CompoundName.
@throws InvalidNameException if name is CompositeName and spans more than one name space.
@throws NamingException if any other naming exception occurs
geode-core/src/main/java/org/apache/geode/internal/jndi/ContextImpl.java