[jbosscache-issues] [JBoss JIRA] (JBCACHE-399) CachedMapImpl doesn't store key objects

Scott Marlow (JIRA) jira-events at lists.jboss.org
Mon Aug 6 16:26:07 EDT 2012


     [ https://issues.jboss.org/browse/JBCACHE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Marlow reassigned JBCACHE-399:
------------------------------------

    Assignee: Scott Marlow  (was: Scott Marlow (Novell))

    
> CachedMapImpl doesn't store key objects
> ---------------------------------------
>
>                 Key: JBCACHE-399
>                 URL: https://issues.jboss.org/browse/JBCACHE-399
>             Project: JBoss Cache
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Legacy POJO Cache 
>    Affects Versions: 1.2.4SP1
>            Reporter: twundke
>            Assignee: Scott Marlow
>             Fix For: 2.0.0.GA
>
>
> 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, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosscache-issues mailing list