Name: avC70361 Date: 12/08/97
The java.util.ArrayMap class fails to be serialized despite of implementing
the java.io.Serializable interface because unexpected exception
NotSerializableException for class java.util.ArrayMap$Entry is thrown.
Here is the test demonstrating the bug
----------ArrayMapTest.java------
import java.util.ArrayMap;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
public class ArrayMapTest {
public static void main(String args[]) {
ObjectOutputStream stream = null;
try {
stream = new ObjectOutputStream(
new ByteArrayOutputStream()
);
} catch(IOException e) {
System.out.println("Unexpected exception : " + e);
System.exit(1);
}
try {
ArrayMap map = new ArrayMap();
map.put("key", "entry");
stream.writeObject(map);
} catch(IOException e) {
System.out.println("Unexpected exception : " + e);
}
}
}
-------The test output----------
#>java ArrayMapTest
Unexpected exception : java.io.NotSerializableException: java.util.ArrayMap$Entry
--------------------------------
======================================================================
The java.util.ArrayMap class fails to be serialized despite of implementing
the java.io.Serializable interface because unexpected exception
NotSerializableException for class java.util.ArrayMap$Entry is thrown.
Here is the test demonstrating the bug
----------ArrayMapTest.java------
import java.util.ArrayMap;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
public class ArrayMapTest {
public static void main(String args[]) {
ObjectOutputStream stream = null;
try {
stream = new ObjectOutputStream(
new ByteArrayOutputStream()
);
} catch(IOException e) {
System.out.println("Unexpected exception : " + e);
System.exit(1);
}
try {
ArrayMap map = new ArrayMap();
map.put("key", "entry");
stream.writeObject(map);
} catch(IOException e) {
System.out.println("Unexpected exception : " + e);
}
}
}
-------The test output----------
#>java ArrayMapTest
Unexpected exception : java.io.NotSerializableException: java.util.ArrayMap$Entry
--------------------------------
======================================================================
- relates to
-
JDK-4098624 java.util.HashMap serialization is incompatible on diffrent platforms
-
- Closed
-