ValidationInfo (JComponent component, String repository) { if (repository.length() == 0) { return new ValidationInfo(DvcsBundle.message("clone.repository.url.error.empty"), component); } repository = sanitizeCloneUrl(repository); // Is it a proper URL? try { if (new URI(repository).isAbsolute()) { return null; } } catch (URISyntaxException urlExp) { // do nothing } // Is it SSH URL? if (SSH_URL_PATTERN.matcher(repository).matches()) { return null; } // Is it FS URL? try { Path path = Paths.get(repository); if (path.toFile().exists()) { if (!path.toFile().isDirectory()) { return new ValidationInfo(DvcsBundle.message("clone.repository.url.error.not.directory"), component); } return null; } } catch (Exception fileExp) { // do nothing } return new ValidationInfo(DvcsBundle.message("clone.repository.url.error.invalid"), component); }