From: Michael Koch Date: Mon, 3 May 2004 14:40:59 +0000 (+0000) Subject: re PR libgcj/14695 ([3.3/3.4 only] java.net.NetworkInterface.getByName() throws excep... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=493b3c9c47bcb52cc518a865a9d79fddd563337d;p=gcc.git re PR libgcj/14695 ([3.3/3.4 only] java.net.NetworkInterface.getByName() throws exception instead of returning null) 2004-05-03 Michael Koch Fixes PR libgcj/14695: * java/net/NetworkInterface.java (getByName): Return null when no interface was found. From-SVN: r81434 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index e2968ca346f..68af3d44ada 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2004-05-03 Michael Koch + + Fixes PR libgcj/14695: + * java/net/NetworkInterface.java + (getByName): Return null when no interface was found. + 2004-04-30 Ranjit Mathew Tom Tromey diff --git a/libjava/java/net/NetworkInterface.java b/libjava/java/net/NetworkInterface.java index e7f7290febc..ab6d7b4263f 100644 --- a/libjava/java/net/NetworkInterface.java +++ b/libjava/java/net/NetworkInterface.java @@ -130,12 +130,15 @@ public final class NetworkInterface } /** - * Returns an network interface by name + * Returns an network interface by name * - * @param name The name of the interface to return + * @param name The name of the interface to return + * + * @return a NetworkInterface object representing the interface, + * or null if there is no interface with that name. * - * @exception SocketException If an error occurs - * @exception NullPointerException If the specified name is null + * @exception SocketException If an error occurs + * @exception NullPointerException If the specified name is null */ public static NetworkInterface getByName(String name) throws SocketException @@ -150,7 +153,8 @@ public final class NetworkInterface return tmp; } - throw new SocketException("no network interface with this name exists"); + // No interface with the given name found. + return null; } /**