harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r490716 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/InetAddress.java test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
Date Thu, 28 Dec 2006 13:20:08 GMT
Author: tellison
Date: Thu Dec 28 05:20:08 2006
New Revision: 490716

URL: http://svn.apache.org/viewvc?view=rev&rev=490716
Log:
Apply patch for HARMONY-1842 ([classlib][net]java.net.InetAddress.isReachable(NetworkInterface,
int, int) throws NPE)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java?view=diff&rev=490716&r1=490715&r2=490716
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java Thu
Dec 28 05:20:08 2006
@@ -814,6 +814,9 @@
     private boolean isReachableByMultiThread(NetworkInterface netif,
             final int ttl, final int timeout, final boolean isICMP)
             throws IOException {
+        if (null == netif.addresses) {
+            return false;
+        }
         Enumeration<InetAddress> addresses = netif.getInetAddresses();
         reached = false;
         addrCount = netif.addresses.length;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java?view=diff&rev=490716&r1=490715&r2=490716
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
Thu Dec 28 05:20:08 2006
@@ -486,6 +486,15 @@
         ia = Inet4Address.getByName("1.1.1.1");
         assertFalse(ia.isReachable(1000));
         assertFalse(ia.isReachable(null, 0, 1000));
+
+        // Regression test for HARMONY-1842.
+        ia = InetAddress.getByName("localhost"); //$NON-NLS-1$
+        Enumeration<NetworkInterface> nif = NetworkInterface.getNetworkInterfaces();
+        NetworkInterface netif;
+        while(nif.hasMoreElements()) {
+            netif = nif.nextElement();
+            ia.isReachable(netif, 10, 1000);
+        }
     } 
 
     // comparator for InetAddress objects



Mime
View raw message