Пример #1
0
 public void parseRfbPortNumber(String port) throws WrongParameterException {
   try {
     portNumber = Integer.parseInt(port);
   } catch (NumberFormatException e) {
     portNumber = 0;
     if (!Strings.isTrimmedEmpty(port)) {
       throw new WrongParameterException("Wrong port number: " + port + "\nMust be in 0..65535");
     }
   }
   if (portNumber > 65535 || portNumber < 0)
     throw new WrongParameterException(
         "Port number is out of range: " + port + "\nMust be in 0..65535");
 }
Пример #2
0
 public void completeEmptyFieldsFrom(ConnectionParams from) {
   if (null == from) return;
   if (Strings.isTrimmedEmpty(hostName) && !Strings.isTrimmedEmpty(from.hostName)) {
     hostName = from.hostName;
   }
   if (0 == portNumber && from.portNumber != 0) {
     portNumber = from.portNumber;
   }
   if (Strings.isTrimmedEmpty(sshUserName) && !Strings.isTrimmedEmpty(from.sshUserName)) {
     sshUserName = from.sshUserName;
   }
   if (Strings.isTrimmedEmpty(sshHostName) && !Strings.isTrimmedEmpty(from.sshHostName)) {
     sshHostName = from.sshHostName;
   }
   if (0 == sshPortNumber && from.sshPortNumber != 0) {
     sshPortNumber = from.sshPortNumber;
   }
   useSsh |= from.useSsh;
 }
Пример #3
0
 public boolean isHostNameEmpty() {
   return Strings.isTrimmedEmpty(hostName);
 }
Пример #4
0
 public boolean useSsh() {
   return useSsh && !Strings.isTrimmedEmpty(sshHostName);
 }