From: "Raif S. Naffah" <raif@swiftdsl.com.au>
To: mauve-discuss@sourceware.org
Subject: patch to ensure hostnames w/ extra spaces are recognized
Date: Sun, 01 Jan 2006 23:35:00 -0000 [thread overview]
Message-ID: <200601021036.57527.raif@swiftdsl.com.au> (raw)
[-- 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 --]
reply other threads:[~2006-01-01 23:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200601021036.57527.raif@swiftdsl.com.au \
--to=raif@swiftdsl.com.au \
--cc=mauve-discuss@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).