This is the mail archive of the mailing list for the Mauve project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: SeverSocket.toString() not specified


On Fri, 2002-04-05 at 15:33, Koster, K.J. wrote:

> While I agree that it's not formally specified, I think that the
> representation of IP addresses as strings is pretty much written in stone by
> now. I think it will be safe to assume what the returned format is going to
> be. Anyone writing an implementation of InetAddress that returns the IP
> address for example in hexadecimal notation better make that their #1 FAQ
> item.

I have noticed the toString() methods do vary a little bit, do they
contain a [] around the returned string, do they actually resolve the
hostname, sometimes there is an extra space somewhere, etc.

But I agree that if it does not even contain the InetAddress as dotted
decimals then the user might be very confused. Maybe changing the test
as follows might be more correct.

    * gnu/testlet/java/net/ServerSocket/
    (test_params): Make toString() tests less strict, just check if they
    contain the ip number.

What do you think?


Index: gnu/testlet/java/net/ServerSocket/
RCS file: /cvs/mauve/mauve/gnu/testlet/java/net/ServerSocket/,v
retrieving revision 1.2
diff -u -r1.2
---	1999/07/12 16:26:14	1.2
+++	2002/04/05 14:23:36
@@ -165,15 +165,13 @@
 			catch ( Exception e ){}
+			String ip = "";
+			harness.check(sock.toString().indexOf(ip) != -1,
+				"toString() should contain IP");
+			harness.check(sock.getInetAddress().toString().indexOf(ip) != -1,
+				"InetAddress toString() should contain IP");
-			if ( !sock.toString().equals(
-"Error : test_params failed - 4" + "toString did not return proper values " );
-			if ( !sock.getInetAddress().toString().equals(
-			  "all-zeros-broadcast/"))
-"Error : test_params failed - 5" + "getInetAddress did not return proper values " );
 			sock.setSocketFactory( null );

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]