@Nullable
  public RepositoryTreeNode findByUrl(final RepositoryTreeNode oldNode) {
    if (oldNode.getParent() == null) {
      return oldNode;
    }

    TreeNode[] oldPath = getPathToRoot(oldNode);
    if (! (oldPath[0] instanceof RepositoryTreeNode)) {
      oldPath = Arrays.copyOfRange(oldPath, 1, oldPath.length);
    }

    TreeNode root = (TreeNode) getRoot();
    if (! (root instanceof RepositoryTreeNode)) {
      final Enumeration children = root.children();
      root = null;
      while (children.hasMoreElements()) {
        TreeNode node = (TreeNode) children.nextElement();
        if ((node instanceof RepositoryTreeNode treeNode) && (treeNode.getURL().equals(((RepositoryTreeNode) oldPath[0]).getURL()))) {
          root = node;
          break;
        }
      }
    } else {
      if (!((RepositoryTreeNode) root).getURL().equals(((RepositoryTreeNode) oldPath[0]).getURL())) {
        return null;
      }
    }
    if (root == null) {
      return null;
    }

    for (int i = 1; i < oldPath.length; i++) {
      final TreeNode treeNode = oldPath[i];
      if (root == null) {
        return null;
      }
      root = getChild((RepositoryTreeNode) root, ((RepositoryTreeNode) treeNode).getURL());
    }

    return (RepositoryTreeNode) root;
  }
@Nullable
  public RepositoryTreeNode findByUrl(final RepositoryTreeNode oldNode)