harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r429368 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/IdentityHashMap.java test/java/tests/api/java/util/IdentityHashMap2Test.java test/resources/serialization/java/util/IdentityHashMapTest.golden.0.ser
Date Mon, 07 Aug 2006 15:35:07 GMT
Author: tellison
Date: Mon Aug  7 08:35:06 2006
New Revision: 429368

URL: http://svn.apache.org/viewvc?rev=429368&view=rev
Log:
Apply patch for HARMONY-1079 ([classlib][luni] Serialized form of java.util.IdentityHashMap
from RI can not be properly deserialized by Harmony)

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IdentityHashMapTest.golden.0.ser
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java?rev=429368&r1=429367&r2=429368&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/IdentityHashMap.java
Mon Aug  7 08:35:06 2006
@@ -1,4 +1,4 @@
-/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2004, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -742,6 +742,7 @@
 	}
 
 	private void writeObject(ObjectOutputStream stream) throws IOException {
+        stream.defaultWriteObject();
 		stream.writeInt(size);
 		Iterator<?> iterator = entrySet().iterator();
 		while (iterator.hasNext()) {
@@ -754,6 +755,7 @@
 	@SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream stream) throws IOException,
 			ClassNotFoundException {
+        stream.defaultReadObject();
 		int savedSize = stream.readInt();
 		threshold = getThreshold(DEFAULT_MAX_SIZE);
 		elementData = newElementArray(computeElementArraySize());
@@ -761,5 +763,6 @@
 			K key = (K)stream.readObject();
 			put(key, (V)stream.readObject());
 		}
+        size = savedSize;
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java?rev=429368&r1=429367&r2=429368&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java
Mon Aug  7 08:35:06 2006
@@ -1,4 +1,4 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import tests.util.SerializationTester;
+
 public class IdentityHashMap2Test extends junit.framework.TestCase {
 
 	/**
@@ -314,4 +316,19 @@
 		assertTrue("newset and keyset do not have same elements 2", set
 				.equals(newset));
 	}
+    
+    /**
+     * @tests java.util.IdentityHashMap#serializationTest
+     */
+    public void test_serialization_compatibility() throws Exception {
+        IdentityHashMap<String, String> identityHashMap = new IdentityHashMap<String,
String>();
+        identityHashMap.put("key1", "value1");
+        identityHashMap.put("key2", "value2");
+        identityHashMap.put("key3", "value3");
+
+        IdentityHashMap<String, String> nobj = (IdentityHashMap<String, String>)
SerializationTester
+                .readObject(identityHashMap,
+                        "serialization/java/util/IdentityHashMapTest.golden.0.ser");
+        assertEquals(identityHashMap.size(), nobj.size());
+    }
 }

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

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



Mime
View raw message