* patch to ensure hostnames w/ extra spaces are recognized
@ 2006-01-01 23:35 Raif S. Naffah
0 siblings, 0 replies; only message in thread
From: Raif S. Naffah @ 2006-01-01 23:35 UTC (permalink / raw)
To: mauve-discuss
[-- Attachment #1.1: Type: text/plain, Size: 380 bytes --]
hello there,
pls. find attached a patch to InetAddress.getAllByName that tests for
hostname strings with extra space characters.
the corresponding ChangeLog entry follows:
2006-01-01 Raif S. Naffah <raif@swiftdsl.com.au>
* gnu/testlet/java/net/InetAddress/getAllByName.java (test):
Ensure hostname strings with extra spaces are recognized.
cheers;
rsn
[-- Attachment #1.2: mauve-20060102b.patch --]
[-- Type: text/x-diff, Size: 2044 bytes --]
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());
+ }
}
}
[-- Attachment #2: Type: application/pgp-signature, Size: 216 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-01-01 23:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-01 23:35 patch to ensure hostnames w/ extra spaces are recognized Raif S. Naffah
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).