protected static String[] parseHostPortPair(String hostPortPair) throws SQLException {
  String[] splitValues=new String[2];
  if (StringUtils.startsWithIgnoreCaseAndWs(hostPortPair,"address=")) {
    splitValues[HOST_NAME_INDEX]=hostPortPair.trim();
    splitValues[PORT_NUMBER_INDEX]=null;
    return splitValues;
  }
  int portIndex=hostPortPair.indexOf(":");
  String hostname=null;
  if (portIndex != -1) {
    if ((portIndex + 1) < hostPortPair.length()) {
      String portAsString=hostPortPair.substring(portIndex + 1);
      hostname=hostPortPair.substring(0,portIndex);
      splitValues[HOST_NAME_INDEX]=hostname;
      splitValues[PORT_NUMBER_INDEX]=portAsString;
    }
 else {
      throw SQLError.createSQLException(Messages.getString("NonRegisteringDriver.37"),SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE,null);
    }
  }
 else {
    splitValues[HOST_NAME_INDEX]=hostPortPair;
    splitValues[PORT_NUMBER_INDEX]=null;
  }
  return splitValues;
}

protected static String [ ] parseHostPortPair ( String hostPortPair ) throws SQLException { String [ ] splitValues = new String [ 2 ] ; if ( StringUtils . startsWithIgnoreCaseAndWs ( hostPortPair , "address=" ) ) { splitValues [ HOST_NAME_INDEX ] = hostPortPair . trim ( ) ; splitValues [ PORT_NUMBER_INDEX ] = null ; return splitValues ; } int portIndex = hostPortPair . indexOf ( ":" ) ; String hostname = null ; if ( portIndex != - 1 ) { if ( ( portIndex + 1 ) < hostPortPair . length ( ) ) { String portAsString = hostPortPair . substring ( portIndex + 1 ) ; hostname = hostPortPair . substring ( 0 , portIndex ) ; splitValues [ HOST_NAME_INDEX ] = hostname ; splitValues [ PORT_NUMBER_INDEX ] = portAsString ; } else { throw SQLError . createSQLException ( Messages . getString ( "NonRegisteringDriver.37" ) , SQLError . SQL_STATE_INVALID_CONNECTION_ATTRIBUTE , null ) ; } } else { splitValues [ HOST_NAME_INDEX ] = hostPortPair ; splitValues [ PORT_NUMBER_INDEX ] = null ; } return splitValues ; }
parses hostportpair in the form of [ host ] [ : port ] into an array , with the element of index host_name_index being the host ( or null if not specified ) , and the element of index port_number_index being the port ( or null if not specified ) .
