code: public static boolean isLegalPoolInfo(PoolInfo poolInfo) {
      if (poolInfo == null || poolInfo.getPoolGroupName() == null ||
          poolInfo.getPoolName() == null) {
        return false;
      }
      if (INVALID_REGEX_PATTERN.matcher(poolInfo.getPoolGroupName()).matches() ||
          poolInfo.getPoolGroupName().isEmpty()) {
        return false;
      }
      if (INVALID_REGEX_PATTERN.matcher(poolInfo.getPoolName()).matches() ||
          poolInfo.getPoolName().isEmpty()) {
        return false;
      }
      return true;
    }
docs: Returns whether or not the given pool name is legal.
  
  Legal pool names are of nonzero length and are formed only of alphanumeric
  characters, underscores (_), and hyphens (-).
  @param poolInfo the name of the pool to check
  @return true if the name is a valid pool name, false otherwise