harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Harley <george.c.har...@googlemail.com>
Subject Re: svn commit: r412049 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/NetworkInterface.java
Date Tue, 06 Jun 2006 11:05:35 GMT
Mikhail Loenko wrote:
> Hi George
>
> Do you have a test that failed? It would be nice to add a regression 
> test...
>
> Thanks,
> Mikhail
>

Hi Mikhail,

Yes I did see test failures because of this. Specifically, I saw a NPE 
being thrown from the setUp() method of 
tests.api.java.net.NetworkInterfaceTest so that every test method in 
that class aborted on error. First saw this behaviour yesterday but - 
given that no one else was reporting it - assumed it might be a 
configuration problem on my part (wouldn't be the first time). However, 
on returning to the matter this morning I saw that the problem was 
actually down to the fact that while my workstation has multiple network 
interfaces (e.g a wireless network adapter, a "wired" Ethernet network 
adapter) only one was bound to an address when the test was run. 
Subsequently, only one of the corresponding array of NetworkInterface 
instances actually has an InetAddress.

I first saw this "multiple adapters" problem a couple of months back 
when attempting to dig the NetworkInterfaceTest from out of the test 
excludes list. Check the comments I added in the setUp() method. So from 
my perspective, the test suite did it's job of drawing attention to an 
error although it was dependent on the kind of hardware that was running 
the test. One of the strengths of having such a diverse group of folks - 
and their workstations - involved in this I suppose.

Best regards,
George


>
>> -----Original Message-----
>> To: harmony-commits@incubator.apache.org
>> Subject: svn commit: r412049 -
>> /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/NetworkInterface.jav

>>
>> a
>>
>> Author: gharley
>> Date: Tue Jun  6 01:51:43 2006
>> New Revision: 412049
>>
>> URL: http://svn.apache.org/viewvc?rev=412049&view=rev
>> Log:
>> Fixing NPE problem introduced in HARMONY-500 when machine has more
> than one network interface.
>>
>> Modified:
>>
>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/NetworkInterface.java

>>
>>
>> Modified:
>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/NetworkInterface.java

>>
>> URL:
>> http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/j

>>
>> ava/net/NetworkInterface.java?rev=412049&r1=412048&r2=412049&view=diff
>> ============================================================================== 
>>
>> ---
>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/NetworkInterface.java

>>
>> (original)
>> +++
>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/NetworkInterface.java

>>
>> Tue Jun  6 01:51:43 2006
>> @@ -298,15 +298,19 @@
>>         }
>>
>>         for (NetworkInterface netif : interfaces) {
>> -            for (InetAddress addr : netif.addresses) {
>> -                if (16 == addr.ipaddress.length) {
>> -                    if (addr.isLinkLocalAddress() ||
> addr.isSiteLocalAddress()) {
>> -                        ((Inet6Address) addr).scopedIf = netif;
>> -                        ((Inet6Address) addr).ifname = netif.name;
>> -                        ((Inet6Address) addr).scope_ifname_set = true;
>> +            // Ensure that current NetworkInterface is bound to at 
>> least
>> +            // one InetAddress before processing
>> +            if (netif.addresses != null) {
>> +                for (InetAddress addr : netif.addresses) {
>> +                    if (16 == addr.ipaddress.length) {
>> +                        if (addr.isLinkLocalAddress() ||
> addr.isSiteLocalAddress()) {
>> +                            ((Inet6Address) addr).scopedIf = netif;
>> +                            ((Inet6Address) addr).ifname = netif.name;
>> +                            ((Inet6Address) addr).scope_ifname_set = 
>> true;
>> +                        }
>>                     }
>>                 }
>> -            }
>> +            }// end if
>>         }
>>
>>         return (new Vector<NetworkInterface>(Arrays.asList(interfaces)))
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message