History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CACHE-255
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Lars Torunski
Reporter: Michiel Meeuwissen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OSCache

AbstractConcurrentReadCache#put(Object key, Object value) may return a wrong value

Created: 04/Sep/06 07:41 AM   Updated: 24/Mar/07 06:18 AM
Component/s: Base Classes
Affects Version/s: 2.3.2
Fix Version/s: 2.4

Environment: Java 1.5


 Description  « Hide
The method put(Object key, Object value) calls the method

private Object put(Object key, Object value, boolean persist)

On line 1630 of revision 382 we see:

return newEntry;

IHO words put returns the new value wrapped into an Entry object.

This is wrong. The put method of a Map should return the old value or null.

I suspect in this case null must be returned. Or otherwise the old value.

Anyway Entry object is probably not of the correct, expected, type.

 All   Comments   Change History      Sort Order:
Lars Torunski - [04/Sep/06 04:32 PM ]
Without checking the source code and docs in detail, I still didn't find a code fragment where the return value is used.
Hence this issue isn't a problem now, but may result in bigger issues when a developer is using OSCache according to the docs.

Michiel Meeuwissen - [05/Sep/06 02:54 AM ]
I was converting a class which was wrapping this class, to use java 1.5 generics. See http://cvs.mmbase.org/viewcvs/applications/oscache-cache/src/org/mmbase/cache/oscache/OSCacheImplementation.java?view=markup

So I had to cast to the right type, to satisfy the compiler. Resulting in a CCE on use, and like that I discovered this issue.

I'm not so sure this was worth the trouble in the first place now .... :-)


Lars Torunski - [10/Sep/06 05:01 PM ]
AbstractConcurrentReadCache won't return a wrong evicted value anymore