commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (COLLECTIONS-266) Issue with MultiKey when serialized/deserialized via RMI
Date Sat, 07 Nov 2015 20:55:11 GMT

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

Thomas Neidhart updated COLLECTIONS-266:
----------------------------------------
    Fix Version/s: 3.2.2

> 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.2.2, 4.0-alpha1, 4.0
>
>         Attachments: CC-266-final.patch, COLLECTIONS-266.patch, MultiKey.java, TestCollections266.java,
TestCollections266.java, TestCollections266.java, collections-testcase-266.diff
>
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message