public static ValidationInfo validateServer(
     SonarQubeServer server, SonarQubeServerDialog dialog) {
   try {
     URL url = new URL(server.getUrl());
     if (url.getPort() != -1 && (url.getPort() < 0 || url.getPort() > 0xFFFF)) {
       return new ValidationInfo("Port out of range:" + url.getPort(), dialog.getUrlTextField());
     }
   } catch (MalformedURLException e) {
     return new ValidationInfo("Invalid URL: " + e.getMessage(), dialog.getUrlTextField());
   }
   return null;
 }
 public static ValidationInfo validateNewServer(
     List<SonarQubeServer> otherServers, SonarQubeServer server, SonarQubeServerDialog dialog) {
   if (!SERVER_ID_PATTERN.matcher(server.getId()).matches()) {
     return new ValidationInfo(
         "Invalid server ID: " + server.getId() + ". Should match " + SERVER_ID_REGEXP,
         dialog.getIdTextField());
   }
   for (SonarQubeServer other : otherServers) {
     if (other.getId().equals(server.getId())) {
       return new ValidationInfo(
           SonarQubeBundle.message("sonarqube.settings.server.duplicateId", server.getId()),
           dialog.getUrlTextField());
     }
   }
   return validateServer(server, dialog);
 }