You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Stephen Colebourne (JIRA)" <ji...@apache.org> on 2006/07/18 23:30:15 UTC

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

     [ http://issues.apache.org/jira/browse/COLLECTIONS-217?page=all ]

Stephen Colebourne updated COLLECTIONS-217:
-------------------------------------------

      Component/s: Map
                       (was: Bag)
    Fix Version/s: 3.3
         Assignee: Stephen Colebourne

> Flat3Map.Entry.setValue() overwrites other Entry values
> -------------------------------------------------------
>
>                 Key: COLLECTIONS-217
>                 URL: http://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
>         Assigned To: Stephen Colebourne
>            Priority: Critical
>             Fix For: 3.3
>
>
> 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 contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org