< prev index next >

src/java.base/share/classes/java/net/InetAddress.java

Print this page

        

*** 375,385 **** return false; } /** * Utility routine to check if the InetAddress is a wildcard address. ! * @return a {@code boolean} indicating if the Inetaddress is * a wildcard address. * @since 1.4 */ public boolean isAnyLocalAddress() { return false; --- 375,385 ---- return false; } /** * Utility routine to check if the InetAddress is a wildcard address. ! * @return a {@code boolean} indicating if the InetAddress is * a wildcard address. * @since 1.4 */ public boolean isAnyLocalAddress() { return false;
*** 1020,1030 **** /** * <p>Lookup a host mapping by name. Retrieve the IP addresses * associated with a host. * ! * <p>Search the configured hosts file for the addresses assocaited with * with the specified host name. * * @param host the specified hostname * @return array of IP addresses for the requested host * @throws UnknownHostException --- 1020,1030 ---- /** * <p>Lookup a host mapping by name. Retrieve the IP addresses * associated with a host. * ! * <p>Search the configured hosts file for the addresses associated * with the specified host name. * * @param host the specified hostname * @return array of IP addresses for the requested host * @throws UnknownHostException
*** 1036,1046 **** String addrStr = null; InetAddress[] res = null; byte addr[] = new byte[4]; ArrayList<InetAddress> inetAddresses = null; ! // lookup the file and create a list InetAddress for the specfied host try (Scanner hostsFileScanner = new Scanner(new File(hostsFile), "UTF-8")) { while (hostsFileScanner.hasNextLine()) { hostEntry = hostsFileScanner.nextLine(); if (!hostEntry.startsWith("#")) { hostEntry = removeComments(hostEntry); --- 1036,1046 ---- String addrStr = null; InetAddress[] res = null; byte addr[] = new byte[4]; ArrayList<InetAddress> inetAddresses = null; ! // lookup the file and create a list InetAddress for the specified host try (Scanner hostsFileScanner = new Scanner(new File(hostsFile), "UTF-8")) { while (hostsFileScanner.hasNextLine()) { hostEntry = hostsFileScanner.nextLine(); if (!hostEntry.startsWith("#")) { hostEntry = removeComments(hostEntry);
*** 1339,1349 **** } if ((addr = IPAddressUtil.textToNumericFormatV6(host)) == null && host.contains(":")) { throw new UnknownHostException(host + ": invalid IPv6 address"); } } else if (ipv6Expected) { ! // Means an IPv4 litteral between brackets! throw new UnknownHostException("["+host+"]"); } InetAddress[] ret = new InetAddress[1]; if(addr != null) { if (addr.length == Inet4Address.INADDRSZ) { --- 1339,1349 ---- } if ((addr = IPAddressUtil.textToNumericFormatV6(host)) == null && host.contains(":")) { throw new UnknownHostException(host + ": invalid IPv6 address"); } } else if (ipv6Expected) { ! // Means an IPv4 literal between brackets! throw new UnknownHostException("["+host+"]"); } InetAddress[] ret = new InetAddress[1]; if(addr != null) { if (addr.length == Inet4Address.INADDRSZ) {
*** 1356,1366 **** } } return ret; } } else if (ipv6Expected) { ! // We were expecting an IPv6 Litteral, but got something else throw new UnknownHostException("["+host+"]"); } return getAllByName0(host, reqAddr, true, true); } --- 1356,1366 ---- } } return ret; } } else if (ipv6Expected) { ! // We were expecting an IPv6 Literal, but got something else throw new UnknownHostException("["+host+"]"); } return getAllByName0(host, reqAddr, true, true); }
< prev index next >