ValidationInfo (@NotNull String directoryPath, @NotNull JComponent component) { if (directoryPath.length() == 0) { return new ValidationInfo(""); } try { Path path = Paths.get(directoryPath); if (!path.toFile().exists()) { return null; } else if (!path.toFile().isDirectory()) { return new ValidationInfo(DvcsBundle.message("clone.destination.directory.error.not.directory"), component); } else if (!isDirectoryEmpty(path)) { return new ValidationInfo(DvcsBundle.message("clone.destination.directory.error.exists"), component); } } catch (InvalidPathException | IOException e) { return new ValidationInfo(DvcsBundle.message("clone.destination.directory.error.invalid"), component); } return null; }