/**
   * Returns a Map of the children, ordered by id.
   *
   * @param watcher optional watcher on getChildren() operation.
   * @return map from id to child name for all children
   */
  private TreeMap<KEY, String> orderedChildren(Watcher watcher)
      throws KeeperException, InterruptedException {
    TreeMap<KEY, String> orderedChildren = new TreeMap<KEY, String>();

    List<String> childNames = null;
    try {
      childNames = zookeeper.getChildren(dir, watcher);
    } catch (KeeperException.NoNodeException e) {
      throw e;
    }

    for (String childName : childNames) {
      try {

        /*
         * CHANGED FROM... if(!childName.regionMatches(0, prefix, 0,
         * prefix.length())){
         * LOGGER.warn("Found child node with improper name: " +
         * childName); continue; } String suffix =
         * childName.substring(prefix.length()); Long childId = new
         * Long(suffix);
         */

        // Check format
        if (!keyHandler.hasValidName(childName)) {
          LOGGER.warn("Found child node with improper name: " + childName);
          continue;
        }

        KEY childId = keyHandler.generateKey(childName);
        orderedChildren.put(childId, childName);
      } catch (NumberFormatException e) {
        LOGGER.warn("Found child node with improper format : " + childName + " " + e, e);
      }
    }

    return orderedChildren;
  }