@Test public void assertGetIp() { assertNotNull(IpUtils.getIp()); }
public static String getIp() { if (null != cachedIpAddress) { return cachedIpAddress; } NetworkInterface networkInterface = findNetworkInterface(); if (null != networkInterface) { Enumeration<InetAddress> ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress ipAddress = ipAddresses.nextElement(); if (isValidAddress(ipAddress)) { cachedIpAddress = ipAddress.getHostAddress(); return cachedIpAddress; } } } throw new HostException("ip is null"); }
IpUtils { public static String getIp() { if (null != cachedIpAddress) { return cachedIpAddress; } NetworkInterface networkInterface = findNetworkInterface(); if (null != networkInterface) { Enumeration<InetAddress> ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress ipAddress = ipAddresses.nextElement(); if (isValidAddress(ipAddress)) { cachedIpAddress = ipAddress.getHostAddress(); return cachedIpAddress; } } } throw new HostException("ip is null"); } }
IpUtils { public static String getIp() { if (null != cachedIpAddress) { return cachedIpAddress; } NetworkInterface networkInterface = findNetworkInterface(); if (null != networkInterface) { Enumeration<InetAddress> ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress ipAddress = ipAddresses.nextElement(); if (isValidAddress(ipAddress)) { cachedIpAddress = ipAddress.getHostAddress(); return cachedIpAddress; } } } throw new HostException("ip is null"); }  }
IpUtils { public static String getIp() { if (null != cachedIpAddress) { return cachedIpAddress; } NetworkInterface networkInterface = findNetworkInterface(); if (null != networkInterface) { Enumeration<InetAddress> ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress ipAddress = ipAddresses.nextElement(); if (isValidAddress(ipAddress)) { cachedIpAddress = ipAddress.getHostAddress(); return cachedIpAddress; } } } throw new HostException("ip is null"); }  static String getIp(); static String getHostName(); }
IpUtils { public static String getIp() { if (null != cachedIpAddress) { return cachedIpAddress; } NetworkInterface networkInterface = findNetworkInterface(); if (null != networkInterface) { Enumeration<InetAddress> ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress ipAddress = ipAddresses.nextElement(); if (isValidAddress(ipAddress)) { cachedIpAddress = ipAddress.getHostAddress(); return cachedIpAddress; } } } throw new HostException("ip is null"); }  static String getIp(); static String getHostName(); static final String IP_REGEX; }