diff options
author | Michael Koch <konqueror@gmx.de> | 2005-01-09 18:57:32 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2005-01-09 18:57:32 +0000 |
commit | a34664c6badfc80216a1b37ad50c1d89f8434f22 (patch) | |
tree | f1fa201913ca21076284763b3b65bd19bc199f51 /libjava/java/net/InetAddress.java | |
parent | 5a3ed97adb8d216fa4a9e08dba1e36568c8df57f (diff) | |
download | gcc-a34664c6badfc80216a1b37ad50c1d89f8434f22.zip gcc-a34664c6badfc80216a1b37ad50c1d89f8434f22.tar.gz gcc-a34664c6badfc80216a1b37ad50c1d89f8434f22.tar.bz2 |
re PR libgcj/17069 (InetAddress.getLocalHost() returns broken InetAddress object if hostname not set)
2005-01-09 Michael Koch <konqueror@gmx.de>
PR libgcj/17069
* java/net/InetAddress.java (getLocalHost):
Throw UnknownHostException if local hostname cannot be determined.
From-SVN: r93115
Diffstat (limited to 'libjava/java/net/InetAddress.java')
-rw-r--r-- | libjava/java/net/InetAddress.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java index 3306803..cfcf22b 100644 --- a/libjava/java/net/InetAddress.java +++ b/libjava/java/net/InetAddress.java @@ -714,7 +714,7 @@ public class InetAddress implements Serializable } } - if (hostname != null) + if (hostname != null && hostname.length() != 0) { try { @@ -725,6 +725,8 @@ public class InetAddress implements Serializable { } } + else + throw new UnknownHostException(); if (localhost == null) localhost = new InetAddress (loopbackAddress, "localhost"); |