public static boolean validateIpPortList(String ipPortList){
  if (ipPortList == null || ipPortList.isEmpty()) {
    return true;
  }
  String[] serverPortList=ipPortList.split(",");
  for (  String serverPort : serverPortList) {
    String ip=serverPort.substring(0,serverPort.lastIndexOf(":"));
    String port=serverPort.substring(serverPort.lastIndexOf(":") + 1);
    if (ip.startsWith("[") && ip.endsWith("]")) {
      ip=ip.substring(1,ip.length() - 1);
      if (!validateIpv6Addr(ip))       return false;
    }
 else     if (validateIpv6Addr(ip)) {
      return false;
    }
 else     if (!validateHostName(ip)) {
      return false;
    }
    if (!validateUint16(port))     return false;
  }
  return true;
}

public static boolean validateIpPortList ( String ipPortList ) { if ( ipPortList == null || ipPortList . isEmpty ( ) ) { return true ; } String [ ] serverPortList = ipPortList . split ( "," ) ; for ( String serverPort : serverPortList ) { String ip = serverPort . substring ( 0 , serverPort . lastIndexOf ( ":" ) ) ; String port = serverPort . substring ( serverPort . lastIndexOf ( ":" ) + 1 ) ; if ( ip . startsWith ( "[" ) && ip . endsWith ( "]" ) ) { ip = ip . substring ( 1 , ip . length ( ) - 1 ) ; if ( ! validateIpv6Addr ( ip ) ) return false ; } else if ( validateIpv6Addr ( ip ) ) { return false ; } else if ( ! validateHostName ( ip ) ) { return false ; } if ( ! validateUint16 ( port ) ) return false ; } return true ; }
validate the ip - port list for syslog < p / > ex - 1 . 1 . 1 . 1 : 4444 , [ 22 : 22 : : 222 ] : 3333
