commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COLLECTIONS-266) Issue with MultiKey when serialized/deserialized via RMI
Date Tue, 18 Sep 2007 18:57:44 GMT

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

Henri Yandell commented on COLLECTIONS-266:
-------------------------------------------

So... summarizing:

* We want it to remain broken for normal natural hashCodes, as not keeping those in line with
the spec is broken.
* We want to fix it for enums though, as they are special - and Julien's test case is good
there because it models the specialness with the isJVM1 flag.
* Use Julien's fix because the move to transient doesn't break compat. 

Stephen/Joerg???

> 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: COLLECTIONS-266.patch, 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.


Mime
View raw message