[ 
https://issues.apache.org/jira/browse/COLLECTIONS-266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri Yandell closed COLLECTIONS-266.
-------------------------------------

    Resolution: Fixed

 svn ci -m "Applying Joerg's final patch from COLLECTIONS-266, including the 
unit test that shows the problem and fixes the problem by making the hashcode 
transient, and moving the hashcode implementation such that it can be called 
from the deserialization as well as the hashcode method" src

Sending        src/java/org/apache/commons/collections/keyvalue/MultiKey.java
Sending        
src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java
Transmitting file data ..
Committed revision 661577.

> Issue with MultiKey when serialized/deserialized via RMI
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-266
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-266
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: KeyValue
>    Affects Versions: 3.2
>            Reporter: Julien Buret
>            Priority: Minor
>             Fix For: 3.3
>
>         Attachments: CC-266-final.patch, COLLECTIONS-266.patch, 
> collections-testcase-266.diff, MultiKey.java, TestCollections266.java, 
> TestCollections266.java, TestCollections266.java
>
>
> This is because the hash code of MultiKey is calculated only once. 
> So if the MultiKey is deserialized in an other jvm, and if one at least of 
> the subkeys defines its hash code with System.identityHashCode() (for example 
> all the enums does), then the hash code of the MultiKey is no longer valid, 
> and you can't retreive the key in your Map.
> I fixed it by making the cached hash code field transient, and by 
> recalculating the hash code during deserialization. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to