[jboss-jira] [JBoss JIRA] Updated: (JBCACHE-399) CachedMapImpl doesn't store key objects

Ben Wang (JIRA) jira-events at jboss.com
Tue Jul 25 22:21:12 EDT 2006


     [ http://jira.jboss.com/jira/browse/JBCACHE-399?page=all ]

Ben Wang updated JBCACHE-399:
-----------------------------

    Fix Version/s: 2.0.0
                       (was: POJOCache)

> CachedMapImpl doesn't store key objects
> ---------------------------------------
>
>                 Key: JBCACHE-399
>                 URL: http://jira.jboss.com/jira/browse/JBCACHE-399
>             Project: JBoss Cache
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: PojoCache
>    Affects Versions: 1.2.4SP1
>            Reporter: twundke
>         Assigned To: Scott Marlow
>             Fix For: 2.0.0
>
>
> The current implementation of CachedMapImpl forces all keys to be string values. In CachedMapImpl we have:
>    public Object put(Object key, Object value)
>    {
>       return cache_.putObject(AopUtil.constructFqn(getFqn(), key), value); // removed try/catch for brevity
>    }
> The current implementation of AopUtil.constructFqn() essentially calls key.toString(). Therefore, calling keySet() on the map will always return a set of String objects, which is usually not what the user intended.
> I have a fix that stores key objects under a "key" FQN, and value objects under a "value" FQN. So, rather than calling getFqn() I now call either getValueFqn() or getKeyFqn() as appropriate. keySet() now acts the same way as values(), returning the correct object type for each key. This also requires a change to CollectionClassHandler.collectionObjectPut(), which now directly uses the Map.put() method to pre-populate the map, rather than directly adding entries to the cache.
> Note that the unit tests currently only use String objects as keys, so they all pass. A few more unit tests need to be added to cover testing key types.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list