private static @NotNull TreePath getVisiblePathWithValidation(@NotNull JTree tree, int row, int count) {
    if (count != tree.getRowCount()) throw new ConcurrentModificationException("tree is modified");
    TreePath path = tree.getPathForRow(row);
    if (path == null) throw new NullPointerException("path is not found at row " + row);
    return path;
  }
private static @NotNull TreePath getVisiblePathWithValidation(@NotNull JTree tree, int row, int count)