public static String checkAndConvertToCompatibleIPv6Syntax(String hostAddress){
  if (hostAddress.indexOf(":") != -1) {
    LogWrapper logger=LogWrapper.getInstance();
    if (logger.fineEnabled()) {
      logger.fine("IPv6 host address detected, using IPv6 syntax for host in JMX connection URL");
    }
    hostAddress="[" + hostAddress + "]";
    if (logger.fineEnabled()) {
      logger.fine("Compatible host address is : " + hostAddress);
    }
  }
  return hostAddress;
}

public static String checkAndConvertToCompatibleIPv6Syntax ( String hostAddress ) { if ( hostAddress . indexOf ( ":" ) != - 1 ) { LogWrapper logger = LogWrapper . getInstance ( ) ; if ( logger . fineEnabled ( ) ) { logger . fine ( "IPv6 host address detected, using IPv6 syntax for host in JMX connection URL" ) ; } hostAddress = "[" + hostAddress + "]" ; if ( logger . fineEnabled ( ) ) { logger . fine ( "Compatible host address is : " + hostAddress ) ; } } return hostAddress ; }
if the given host address contains a " : " , considers it as an ipv6 address & returns the host based on rfc2732 requirements i . e . surrounds the given host address string with square brackets . if " : " is not found in the given string , simply returns the same string .
