private boolean safeIsDirectory(@NotNull Path dir) {
    try {
      return Files.isDirectory(dir);
    }
    catch (SecurityException se) {
      return false; // when a directory is not accessible we should ignore it
    }
    catch (Exception e) {
      log.debug("Failed to check directory existence: unexpected exception " + e.getClass().getSimpleName() + ": " + e.getMessage(), e);
      return false;
    }
  }
private boolean safeIsDirectory(@NotNull Path dir)