Index: getAllByName.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/net/InetAddress/getAllByName.java,v retrieving revision 1.1 diff -u -r1.1 getAllByName.java --- getAllByName.java 13 Aug 2004 21:59:26 -0000 1.1 +++ getAllByName.java 1 Jan 2006 23:28:56 -0000 @@ -42,5 +42,61 @@ { harness.fail(x.toString()); } + + // getAllByName("") also should return the loopback address + try + { + InetAddress[] addr = InetAddress.getAllByName(""); + harness.check(addr != null); + InetAddress loopback = addr[0]; + harness.check(loopback != null); + harness.check(loopback.isLoopbackAddress()); + } + catch (UnknownHostException x) + { + harness.fail(x.toString()); + } + + // so should getAllByName(" ") + try + { + InetAddress[] addr = InetAddress.getAllByName(" "); + harness.check(addr != null); + InetAddress loopback = addr[0]; + harness.check(loopback != null); + harness.check(loopback.isLoopbackAddress()); + } + catch (UnknownHostException x) + { + harness.fail(x.toString()); + } + + // so should getAllByName("localhost") + try + { + InetAddress[] addr = InetAddress.getAllByName("localhost"); + harness.check(addr != null); + InetAddress loopback = addr[0]; + harness.check(loopback != null); + harness.check(loopback.isLoopbackAddress()); + } + catch (UnknownHostException x) + { + harness.fail(x.toString()); + } + + // so should getAllByName(" localhost ") + try + { + InetAddress[] addr = InetAddress.getAllByName(" localhost "); + harness.check(addr != null); + InetAddress loopback = addr[0]; + harness.check(loopback != null); + harness.check(loopback.isLoopbackAddress()); + } + catch (UnknownHostException x) + { + harness.fail(x.toString()); + } } }