This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Two small java.net fixlets
- From: Mark Wielaard <mark at klomp dot org>
- To: java-patches at gcc dot gnu dot org
- Date: 07 Dec 2002 02:16:33 +0100
- Subject: FYI: Two small java.net fixlets
Hi,
I am committing the following two changes that fix some Mauve failures.
Similar changes were recently made to the GNU Classpath implementations.
2002-12-06 Mark Wielaard <mark@klomp.org>
* java/net/InetAddress.java (toString): Use hostname when not null,
don't do an explicit reverse getHostName() lookup.
* java/net/Socket.java (setSocketImplFactory): When fac == null throw
NullPointerException.
Cheers,
Mark
Index: java/net/InetAddress.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/InetAddress.java,v
retrieving revision 1.12
diff -u -r1.12 InetAddress.java
--- java/net/InetAddress.java 1 Nov 2002 06:35:14 -0000 1.12
+++ java/net/InetAddress.java 7 Dec 2002 01:02:03 -0000
@@ -1,6 +1,6 @@
// INetAddress.java -- An Internet Protocol (IP) address.
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -413,12 +413,13 @@
*/
public String toString()
{
- String hostname = getHostName ();
-
- if (hostname == "")
- hostname = getHostAddress ();
-
- return hostname + '/' + getHostAddress ();
+ String result;
+ String address = getHostAddress();
+ if (hostName != null)
+ result = hostName + "/" + address;
+ else
+ result = address;
+ return result;
}
/**
Index: java/net/Socket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/Socket.java,v
retrieving revision 1.16
diff -u -r1.16 Socket.java
--- java/net/Socket.java 3 Oct 2002 11:23:33 -0000 1.16
+++ java/net/Socket.java 7 Dec 2002 01:02:03 -0000
@@ -892,6 +892,9 @@
if (sm != null)
sm.checkSetFactory();
+ if (fac == null)
+ throw new SocketException("SocketImplFactory cannot be null");
+
factory = fac;
}