From 53404de6fb130cdb4458db1e44e41f3f71d37f6b Mon Sep 17 00:00:00 2001 From: mkoch Date: Mon, 3 May 2004 14:40:59 +0000 Subject: 2004-05-03 Michael Koch Fixes PR libgcj/14695: * java/net/NetworkInterface.java (getByName): Return null when no interface was found. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81434 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/net/NetworkInterface.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'libjava/java/net') 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; } /** -- cgit v1.2.3