-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta
-
x86
-
generic
-
Verified
java.util.IdentityHashMap writeObject(ObjectOutputStream s) when called
is throwning:
java.io.NotActiveException: defaultWriteObject
Test program and output is as below:
import java.util.*;
import java.io.*;
public class Test extends IdentityHashMap {
public static final int SIZE=100;
public static Test t =null;
public static void main(String [] arg) {
t = new Test();
String key = "key";
String value = "value";
for (int i=0; i < SIZE; i++) {
String newKey = key + i;
String newValue = value + i;
t.put(newKey,newValue);
}
t.TestMethod();
}
void TestMethod() {
try {
FileOutputStream wstream = new FileOutputStream("TestFile.ser");
ObjectOutputStream wfile = new ObjectOutputStream(wstream);
t.writeObject(wfile);
wfile.close();
System.out.println("write over");
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------output result-----------------
H:\merlin\dev\testbase\src\libs_api_tests\common\java_util\IdentityHashMap\IdentityHashMapTest2>java -version
java version "1.4.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b41)
Java HotSpot(TM) Client VM (build B41, mixed mode)
H:\merlin\dev\testbase\src\libs_api_tests\common\java_util\IdentityHashMap\IdentityHashMapTest2>java Test
java.io.NotActiveException: defaultWriteObject
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:474)
at java.util.IdentityHashMap.writeObject(IdentityHashMap.java:1007)
at Test.TestMethod(Test.java:26)
at Test.main(Test.java:19)
is throwning:
java.io.NotActiveException: defaultWriteObject
Test program and output is as below:
import java.util.*;
import java.io.*;
public class Test extends IdentityHashMap {
public static final int SIZE=100;
public static Test t =null;
public static void main(String [] arg) {
t = new Test();
String key = "key";
String value = "value";
for (int i=0; i < SIZE; i++) {
String newKey = key + i;
String newValue = value + i;
t.put(newKey,newValue);
}
t.TestMethod();
}
void TestMethod() {
try {
FileOutputStream wstream = new FileOutputStream("TestFile.ser");
ObjectOutputStream wfile = new ObjectOutputStream(wstream);
t.writeObject(wfile);
wfile.close();
System.out.println("write over");
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------output result-----------------
H:\merlin\dev\testbase\src\libs_api_tests\common\java_util\IdentityHashMap\IdentityHashMapTest2>java -version
java version "1.4.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b41)
Java HotSpot(TM) Client VM (build B41, mixed mode)
H:\merlin\dev\testbase\src\libs_api_tests\common\java_util\IdentityHashMap\IdentityHashMapTest2>java Test
java.io.NotActiveException: defaultWriteObject
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:474)
at java.util.IdentityHashMap.writeObject(IdentityHashMap.java:1007)
at Test.TestMethod(Test.java:26)
at Test.main(Test.java:19)