harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r428263 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/ test/java/tests/api/java/net/ test/resources/serialization/java/net/
Date Thu, 03 Aug 2006 06:59:49 GMT
Author: pyang
Date: Wed Aug  2 23:59:49 2006
New Revision: 428263

URL: http://svn.apache.org/viewvc?rev=428263&view=rev
Log:
Fix for HARMONY-1039 ([classlib][luni] java.net.Inet6Address throws NullPointerException when
deserializing an object with "null" interface name.)

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/net/Inet6Address.golden.0.ser
      - copied unchanged from r428211, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/net/Inet6Address.golden.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/net/Inet6Address.golden.1.ser
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet6Address.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/Inet6AddressTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet6Address.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet6Address.java?rev=428263&r1=428262&r2=428263&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet6Address.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet6Address.java
Wed Aug  2 23:59:49 2006
@@ -443,7 +443,7 @@
 		scope_id_set = fields.get("scope_id_set", false);
         ifname = (String)fields.get("ifname", null);
         scope_ifname_set = fields.get("scope_ifname_set", false);
-        if (scope_ifname_set){
+        if (scope_ifname_set && null != ifname){
             scopedIf = NetworkInterface.getByName(ifname);
         }
 	}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/Inet6AddressTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/Inet6AddressTest.java?rev=428263&r1=428262&r2=428263&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/Inet6AddressTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/Inet6AddressTest.java
Wed Aug  2 23:59:49 2006
@@ -24,7 +24,9 @@
 
 public class Inet6AddressTest extends junit.framework.TestCase {
 
-    private static final String SERIALIZATION_FILE_NAME = "serialization/java/net/Inet6Address.golden.ser";
+    private static final String SERIALIZATION_FILE_NAME0 = "serialization/java/net/Inet6Address.golden.0.ser";
+    
+    private static final String SERIALIZATION_FILE_NAME1 = "serialization/java/net/Inet6Address.golden.1.ser";
 
 	/**
 	 * @tests java.net.Inet6Address#isMulticastAddress()
@@ -985,7 +987,25 @@
         byte[] localv6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
         Inet6Address ia = (Inet6Address) InetAddress.getByAddress(localv6);
         Inet6Address deIA = (Inet6Address) SerializationTester.readObject(ia,
-                SERIALIZATION_FILE_NAME);
+                SERIALIZATION_FILE_NAME0);
+        byte[] deAddr = deIA.getAddress();
+        for (int i = 0; i < localv6.length; i++) {
+            assertEquals(localv6[i], deAddr[i]);
+        }
+        assertEquals(ia.getScopeId(), deIA.getScopeId());
+        assertEquals(ia.getScopedInterface(), deIA.getScopedInterface());
+    }
+    
+    /*
+     * Test serialization/deserilazation compatibility with RI.
+     */
+    public void testSerializationCompatibility_NullInterfaceName()
+            throws Exception {
+        // regression test for Harmony-1039
+        byte[] localv6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
+        Inet6Address ia = (Inet6Address) InetAddress.getByAddress(localv6);
+        Inet6Address deIA = (Inet6Address) SerializationTester.readObject(ia,
+                SERIALIZATION_FILE_NAME1);
         byte[] deAddr = deIA.getAddress();
         for (int i = 0; i < localv6.length; i++) {
             assertEquals(localv6[i], deAddr[i]);

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/net/Inet6Address.golden.1.ser
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/net/Inet6Address.golden.1.ser?rev=428263&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/net/Inet6Address.golden.1.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message