You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2013/04/27 23:38:17 UTC

[jira] [Updated] (COLLECTIONS-217) Flat3Map.Entry.setValue() overwrites other Entry values

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

Thomas Neidhart updated COLLECTIONS-217:
----------------------------------------

    Fix Version/s:     (was: 4.0-beta-1)
                   4.0
    
> Flat3Map.Entry.setValue() overwrites other Entry values
> -------------------------------------------------------
>
>                 Key: COLLECTIONS-217
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-217
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 3.2
>         Environment: JDK 1.4, WinXP
>            Reporter: Matt Bishop
>            Assignee: Stephen Colebourne
>            Priority: Critical
>             Fix For: 4.0
>
>
> Flat3Map's Entry objects will overwrite other Entry's values if Entry.setValue() is called on one.  It should only overwrite the Entry at hand.
> I've looked at the source, and the case statement incorrectly falls through, rather than returning like it should:
> Flat3Map.java, lines 646-660:
>         public Object setValue(Object value) {
>             if (canRemove == false) {
>                 throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
>             }
>             Object old = getValue();
>             switch (nextIndex) {
>                 case 3: 
>                     parent.value3 = value;
>                 case 2:
>                     parent.value2 = value;
>                 case 1:
>                     parent.value1 = value;
>             }
>             return old;
>         }
> With this code, if I set the value of the third item in the EntrySet, then all three values are set to the new value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira