Bug 45212 - AbstractReplicatedMap.entrySet returns values not entries.
AbstractReplicatedMap.entrySet returns values not entries.
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Cluster
6.0.16
PC Linux
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-06-16 08:09 UTC by Robert Newson
Modified: 2008-07-04 06:32 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Newson 2008-06-16 08:09:43 UTC
AbstractReplicatedMap implements entrySet() as follows;

        public Set entrySet() {
            LinkedHashSet set = new LinkedHashSet(super.size());
            Iterator i = super.entrySet().iterator();
            while ( i.hasNext() ) {
                Map.Entry e = (Map.Entry)i.next();
                Object key = e.getKey();
                MapEntry entry = (MapEntry)super.get(key);
                if ( entry != null && entry.isPrimary() ) set.add(entry.getValue());
            }
            return Collections.unmodifiableSet(set);
        }

this returns a set of all the *values*, the line set.add(entry.getValue()) should be set.add(entry);
Comment 1 Mark Thomas 2008-06-16 10:27:54 UTC
Thanks for the report. This is fixed in trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2008-07-04 06:32:39 UTC
This has been fixed in 6.0.x and will be included in 6.0.17 onwards.