-
Bug
-
Resolution: Fixed
-
P4
-
1.4.2_08
-
b01
-
other
-
windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2130532 | 6 | Scott Seligman | P3 | Resolved | Fixed | b78 |
JDK-2188897 | 5.0-pool | Vaibhav Choudhary | P3 | Closed | Won't Fix |
java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
DESCRIPTION :
The FastHashMap class is available in the commons.collections package of jakarta. While deSerializing this HashMap, FastIndirection Exception is thrown. The FastHashMap extends from HashMap and also includes a HashMap member variable. FastHashMap also overrides all the methods for HashMap. Any values added to FastHashMap will actually be added to the HashMap which is included as a member. The FastHashMap will be serialized in the below order HashMap (Super class) FastHashMap data members (including the HashMap which is a member). When we try to invoke FastHashMap using writeObject the folllowing happens :
The HashMap writeObject method looks as below :
*********************************************************************************************************************************************
private void writeObject(java.io.ObjectOutputStream s)throws IOException
{
// Write out the threshold, loadfactor, and any hidden stuff
s.defaultWriteObject();
// Write out number of buckets
s.writeInt(table.length);
// Write out size (number of Mappings)
s.writeInt(size);
// Write out keys and values (alternating)
for (Iterator i = entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
s.writeObject(e.getKey());
s.writeObject(e.getValue());
}
}
*********************************************************************************************************************************************
When the superclass HashMap is serialized the size is serialized as 0 and when the entrySet() is invoked the FastHashMap returns the entrySet() of the embedded HashMap. This results in the values within the member HashMap being written to the stream. When the Member HashMap gets serialized, the values get serialized as Value indirections to the above marshalled values of the superclass HashMap. The readObject method of HashMap reads the values based on the size which is serialized. While reading the superclass HashMap it reads the size as 0 and does not read the following values. This results in these values being skipped (hence not being added to the valuecCache) by the CDRInputStream logic. While reading the member HashMap (size is not 0) we read indirections to the superclass HashMap (values been skipped) and we throw up with a FastIndirectionException.
STEPS TO REPRODUCE THE ISSUE :
Attached is the testcase. Follow the steps below to reproduce the issue :
1. Extract the zip file.
2. The customer is using jakarta commons-collections-3.0.jar. Hence set the path for the same in the compile.bat file inside the folder server and client.
3. Also set the path for the same in the server.bat and client.bat file in the folder server and client respectively.
4. Run the compile.bat to for both server and client.
5. Start the tnameservice.
6. To start the server, run server.bat.
7. To run the client run client.bat.
TRACE INFORMATION :
Attached is the server trace file that shows the FastIndirectionException.
###@###.### 2005-06-06 16:40:37 GMT
- backported by
-
JDK-2130532 (coll) Exception thrown while deserializing HashMap
-
- Resolved
-
-
JDK-2188897 (coll) Exception thrown while deserializing HashMap
-
- Closed
-
- relates to
-
JDK-6383088 (coll) The writeObject() specification in HashMap.java was changed in 1.4.2_11
-
- Resolved
-
-
JDK-6345452 JCK14a api/java_util HashMap serial constructor test throws IllegalArgumentException for 1.4.2_11 b1
-
- Closed
-
-
JDK-6351146 Regression : 4901731 encoder test passing with 142_10-b03 but failing with 142_11-b01
-
- Closed
-
-
JDK-6352908 Regression:HashMap threw Exception CORBA MARSHAL for 142_11-b01 but passes for 142_10-b03 for all OS
-
- Closed
-