harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hindess <mark.hind...@googlemail.com>
Subject Re: svn commit: r964001 - in /harmony/enhanced/java/trunk/classlib/modules/luni/src: main/java/java/net/InetSocketAddress.java test/api/common/org/apache/harmony/luni/tests/java/net/InetSocketAddressTest.java
Date Wed, 14 Jul 2010 11:35:50 GMT

In message <20100714103700.1592F23889B6@eris.apache.org>, odeakin@apache.org
writes:
>
> Author: odeakin
> Date: Wed Jul 14 10:36:59 2010
> New Revision: 964001
> 
> URL: http://svn.apache.org/viewvc?rev=964001&view=rev
> Log:
> To match the RI's behaviour, resolve and store the hostname when getHostName 
> is called. Add a flag so we do not resolve the hostname for every call to get
> HostName. Also add a regression test for the behaviour.
>
> [SNIP]
>
> --- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org
> /apache/harmony/luni/tests/java/net/InetSocketAddressTest.java (original)
> +++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org
> /apache/harmony/luni/tests/java/net/InetSocketAddressTest.java Wed Jul 14 10:
> 36:59 2010
> @@ -31,7 +31,9 @@ public class InetSocketAddressTest exten
>      public void test_ConstructorLjava_lang_StringI() throws Exception {
>          // regression test for Harmony-1042
>          InetSocketAddress address = new InetSocketAddress("127.0.0.1", 0);
> -        assertNotNull(address.getHostName());
> +        assertEquals("/127.0.0.1:0", address.toString());
> +        assertEquals("localhost", address.getHostName());
> +        assertEquals("localhost/127.0.0.1:0", address.toString());
>      }
>      
>      /**

I would have assumed that the removed:

  assertNotNull(address.getHostName());

was not:

  assertEquals("localhost", address.getHostName());

for good reasons[0].

Therefore it might be better to make the new code:

    assertEquals("/127.0.0.1:0", address.toString());
    String localhostName = address.getHostName();
    assertNotNull(localhostName);
    assertEquals(localhostName+"/127.0.0.1:0", address.toString());

or something like that?

Regards,
 Mark.

[0] Such as "localhost" being a rather arbitrary string that may be
    different on different machines?  Some older Debian machines
    have "localhost.localdomain" first in their /etc/hosts entries IIRC.



Mime
View raw message