if (address == null) { address = Address.getByName(host);
private static String getConvertedIP(String ip) throws UnknownHostException { // Convert the ip if its an ipv6 ip. For ipv4 no conversion is needed return Address.getByName(ip).getHostAddress(); }
private static String getConvertedIP(String ip) throws UnknownHostException { // Convert the ip if its an ipv6 ip. For ipv4 no conversion is needed return Address.getByName(ip).getHostAddress(); }
@Nullable public static InetAddress resolveByName (@Nonnull final String sHostName) { try { return Address.getByName (sHostName); } catch (final UnknownHostException ex) { return null; } }
/** * TODO how are timeouts handled? Why doesn't dnsjav document exceptions? * @return Absent for unknown host. */ private static Optional<InetAddress> getIpByHost(String hostName) { //TODO do I need to use dnsServers here in case they are set? try { InetAddress addr = Address.getByName(hostName); return Optional.of(addr); } catch (UnknownHostException e) { return Optional.absent(); } }
ipAddress = Address.getByName(mxServer).getHostAddress(); } catch (UnknownHostException ex) { Logger.getLogger(ForwardLookupHelper.class.getName()).log(Level.SEVERE, null, ex);
String ipAddress = Address.getByName(nsServer).getHostAddress(); String realDomain = NetworkTools.getDomainFromHost(nsServer); ForwardLookupResult fr;
private void checkResponse(String reverse, NetworkInterface networkInterface, InetAddress inetAddress) { if (inetAddress.toString().substring(1).equals(reverse)) { LOG.info(String.format("InetAddress %s on interface %s does not have reverse dns name, " + "so their reverse remains: %s", inetAddress, networkInterface.getDisplayName(), reverse)); } else { if (inetAddress.isLoopbackAddress()) { LOG.info(String.format("InetAddress %s on loopback interface %s obtained reverse name as %s", inetAddress, networkInterface.getDisplayName(), reverse)); } else { LOG.info(String.format("InetAddress %s on interface %s has reverse dns name: %s\n", inetAddress, networkInterface.getDisplayName(), reverse)); try { InetAddress checkedAddr = Address.getByName(reverse); assertEquals(inetAddress, checkedAddr); } catch (UnknownHostException uhex) { fail("InetAddress " + inetAddress + " on interface " + networkInterface.getDisplayName() + " got " + reverse + " reverse dns name which in return is an unknown host!"); } } } }
if (address == null) { address = Address.getByName(host);