commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Mehio (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COLLECTIONS-240) MultiValueMap should implement Serializable
Date Tue, 18 Sep 2007 11:03:43 GMT

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

Alan Mehio updated COLLECTIONS-240:
-----------------------------------

    Priority: Minor  (was: Major)

I found a bug in the in the method below from a related  test class; however, this has been
fixed in the latest svn at 

http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/MultiValueMap.java?revision=560660


public boolean putAll(Object key, Collection values) {

   if (coll.size() > 0) {

                 coll = createCollection(values.size()); 
                 boolean result = coll.addAll(values);
                // only add if non-zero size to maintain class state
                getMap().put(key, coll);
                result = false;  // here  should be true since collection has been changed

                // returns true for a none zero one 
            }
            return result;
}


Another issue which  I have noticed is the code line 
 coll = createCollection(values.size());  

the method  
 protected Collection createCollection(int size) {
        return (Collection) collectionFactory.create();
    }

does not use the  "size";  I am guessing the method signature is left because of backward
compatibility

It would be nice it we can create the correct size for the ArrayList instead of the default
one which is 10 
when we add the collection to the newly created ArrrayList  as below

coll = createCollection(values.size()); 
                 boolean result = coll.addAll(values);

this will give better code optimization 




I think MultiValueMap should implement Serializable ( can be serialized)


Regards,
Alan Mehio



> MultiValueMap should implement Serializable
> -------------------------------------------
>
>                 Key: COLLECTIONS-240
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-240
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 3.2
>            Reporter: Wouter de Vaal
>            Assignee: Henri Yandell
>            Priority: Minor
>             Fix For: 3.3
>
>
> Collection classes should be serializable as they are frequently used in model classes
which need to be serializable, for example in a HttpSession object within a servlet container
cluster.

-- 
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