/*
@see org.osgi.service.url.URLStreamHandlerService#getHostAddress(java.net.URL)
15370
@Override
    public InetAddress getHostAddress(URL url) {
        try {
            return (InetAddress) _getHostAddress.invoke(getInstance(), new Object[] { url });
        } catch (Exception e) {
            FFDCFilter.processException(e, getClass().getName(), "getHostAddress", url);
            return null;
        }
    }
9402
public static String getDomainFromURL(String strURL, String strContextPathAtEnd, boolean includePortNumber)
    {
        String strDomain = strURL;
        
        if (strDomain.indexOf(':') < 8)
            strDomain = strDomain.substring(strDomain.indexOf(':') + 1);  // Get rid of protocol
        if (strDomain.indexOf("//") == 0)
            strDomain = strDomain.substring(2);  // Get rid of '//'
        if (strDomain.indexOf('?') != -1)
            strDomain = strDomain.substring(0, strDomain.indexOf('?'));   // Get rid of params
        int iEndDomain = strDomain.indexOf('/');
        if (iEndDomain == -1)
            iEndDomain = strDomain.length();
        if (strDomain.lastIndexOf(Constants.DEFAULT_SERVLET) >= iEndDomain)
            strDomain = strDomain.substring(0, strDomain.lastIndexOf(Constants.DEFAULT_SERVLET) - 1);   // Strip servlet name
        if ((strDomain.indexOf(':') != -1) && (includePortNumber == false))
            strDomain = strDomain.substring(0, strDomain.indexOf(':'));  // Get rid of port number
        else
            strDomain = strDomain.substring(0, iEndDomain);
        
        if (strContextPathAtEnd != null)
        {
            int iStartIndex = strURL.indexOf(strDomain);
            int iContextIndex = strURL.indexOf(strContextPathAtEnd, iStartIndex + strDomain.length());
            if (iContextIndex != -1)
            {   // Always
                iContextIndex = iContextIndex + strContextPathAtEnd.length();
                strDomain = strURL.substring(iStartIndex, iContextIndex);
                if (!strDomain.endsWith(System.getProperty("file.separator")))
                    strDomain = strDomain + System.getProperty("file.separator");
            }
        }
        return strDomain;
    }
292844
static String getHostString(InetSocketAddress socketAddress) {
    InetAddress address = socketAddress.getAddress();
    if (address == null) {
      // The InetSocketAddress was specified with a string (either a numeric IP or a host name). If
      // it is a name, all IPs for that name should be tried. If it is an IP address, only that IP
      // address should be tried.
      return socketAddress.getHostName();
    }
    // The InetSocketAddress has a specific address: we should only try that address. Therefore we
    // return the address and ignore any host name that may be available.
    return address.getHostAddress();
  }
23857
public JsDestinationAddress getProxyHandlerDestAddr() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled()) {
            SibTr.entry(tc, "getProxyHandlerDestAddr");
            SibTr.exit(tc, "getProxyHandlerDestAddr", _proxyHandlerDestAddr);
        }
        return _proxyHandlerDestAddr;
    }
809476
public static String getHost(InetSocketAddress addr) {
    try {
      Method getHostStringMethod = InetSocketAddress.class.getMethod("getHostString");
      return (String) getHostStringMethod.invoke(addr);
    } catch (NoSuchMethodException e) {
      // noop
    } catch (IllegalAccessException e) {
      // noop
    } catch (InvocationTargetException e) {
      // noop
    }
    return addr.getHostName();
  }
1023103
public static InetAddress getInetAddress() {
        InetAddress inetAddress = null;
        try {
            inetAddress = InetAddress.getLocalHost();
        } catch (IOException ioe) {
            logger.error("Error in getting InetAddress", ioe);
        }
        return inetAddress;
    }
1364332
public String getProviderAddress() {
        if (providerAddress!=null) {
            Matcher matcher = HOST_PORT_PATTERN.matcher(providerAddress);
            if (matcher.matches() && isValidPort(matcher.group(2))) {
                return matcher.group(1);
            }
        }else if(providerId!=null){
            Matcher matcher = HOST_PORT_PATTERN.matcher(providerId);
            if (matcher.matches() && isValidPort(matcher.group(2))) {
                return matcher.group(1);
            }
        }
        return providerAddress;
    }
1301934
public static String getLocalhost() {
    if (localhost == null) {
      synchronized (HostAndPort.class) {
        if (localhost == null) {
          return localhost = getLocalHostQuietly();
        }
      }
    }
    return localhost;
  }
1362577
public String getHostAddress() {
        if( addr instanceof NbtAddress ) {
            return ((NbtAddress)addr).getHostAddress();
        }
        return ((InetAddress)addr).getHostAddress();
    }
1094186
@Override
    public String getAddress()
    {
        if (((InetSocketAddress) address.address()).getPort() == 0) {
            return address(address);
        }
        return address.toString();
    }
99552
public int getPort() {
    if (port != null && port != 0) {
      return port;
    }
    return urlParser != null ? urlParser.getHostAddresses().get(0).port : 3306;
  }
833257
public static String formatAddress(InetSocketAddress inet){
        if(inet == null){
            throw new NullPointerException();
        }
        StringBuilder result = new StringBuilder();
        if(inet.isUnresolved()){
            result.append(inet.getHostName());
        }else{
            result.append(formatPossibleIpv6Address(formatAddress(inet.getAddress())));
        }
        result.append(":").append(inet.getPort());
        return result.toString();
    }
382509
public InetAddress
getAddress() {
	try {
		if (name == null)
			return InetAddress.getByAddress(toArray(addr));
		else
			return InetAddress.getByAddress(name.toString(),
							toArray(addr));
	} catch (UnknownHostException e) {
		return null;
	}
}
439412
public java.lang.String getSourceHost() {
    java.lang.Object ref = sourceHost_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        sourceHost_ = s;
      }
      return s;
    }
  }
1174373
public static InetAddress getIPHostAddress(String host) {
        InetAddress result = null;
        Matcher matcher = IPV4_QUADS.matcher(host);
        if (matcher == null || !matcher.matches()) {
            return result;
        }
        try {
            // Doing an Inet.getByAddress() avoids a lookup.
            result = InetAddress.getByAddress(host,
                    new byte[] {
                    (byte)(new Integer(matcher.group(1)).intValue()),
                    (byte)(new Integer(matcher.group(2)).intValue()),
                    (byte)(new Integer(matcher.group(3)).intValue()),
                    (byte)(new Integer(matcher.group(4)).intValue())});
        } catch (NumberFormatException e) {
            logger.warning(e.getMessage());
        } catch (UnknownHostException e) {
            logger.warning(e.getMessage());
        }
        return result;
    }
73683
public static InetAddress getLocalHost() throws UnknownHostException {
        InetAddress addr;
        try {
            addr = InetAddress.getLocalHost();
        } catch (ArrayIndexOutOfBoundsException e) {  //this is workaround for mac osx bug see AS7-3223 and JGRP-1404
            addr = InetAddress.getByName(null);
        }
        return addr;
    }
417104
public static String getLocalhost() throws RuntimeException
	{
		String hostname = null;

		try
		{
			InetAddress addr = InetAddress.getLocalHost();

			hostname = addr.getHostName();
		}
		catch (UnknownHostException e)
		{
			throw new RuntimeException("[FileHelper] {getLocalhost}: Can't get local hostname");
		}

		return hostname;
	}