commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28433] New: - LRUMap.removeLRU(LinkEntry) is passed wrong link entry
Date Fri, 16 Apr 2004 13:51:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28433>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28433

LRUMap.removeLRU(LinkEntry) is passed wrong link entry

           Summary: LRUMap.removeLRU(LinkEntry) is passed wrong link entry
           Product: Commons
           Version: 3.0 Final
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Collections
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: msage@kelvinconnect.com


The following program attempts to add 3 entries (a,b,c) to an LRUMap with max 
size two.

The contents of the LRUMap are always correct but when the LRUMap fills up it 
removes entry "a" but passes entry "b" to the removeLRU method.

run:
     [java] [a]
     [java] [a, b]
     [java] Remove lru b
     [java] [b, c]

import org.apache.commons.collections.map.LRUMap;

public class LRUMapTest {
    public static void main (String[] args) {
	LRUMap map = new LRUMap(2) {
		protected boolean removeLRU(LinkEntry entry) {
		    System.out.println("Remove lru "+entry.getKey());
		    return true;
		}
	    };
	map.put("a","a");
	System.out.println(map.keySet());
	map.put("b","b");
	System.out.println(map.keySet());
	map.put("c","c");
	System.out.println(map.keySet());
    }
}

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