commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne (JIRA)" <j...@apache.org>
Subject [jira] Closed: (COLLECTIONS-217) Flat3Map.Entry.setValue() overwrites other Entry values
Date Tue, 18 Jul 2006 22:03:15 GMT
     [ http://issues.apache.org/jira/browse/COLLECTIONS-217?page=all ]

Stephen Colebourne closed COLLECTIONS-217.
------------------------------------------

    Resolution: Fixed

Fixed in revision 423264

> 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


Mime
View raw message