[ http://issues.apache.org/struts/browse/WW-456?page=comments#action_38812 ] Attila Szegedi commented on WW-456: -----------------------------------
Thanks for clarification. it makes sense, although I think you should just silently remove these issues from JIRA then - they're alive elsewhere anyway. Otherwise, you risk people unearthing these pages through search engines and jumping to conclusions like I did. If marking them as "Not a problem" is an initial step to permanent removal, then consider I didn't say anything after the first sentence :-) > SingleValueMap.entrySet() is broken > ----------------------------------- > > Key: WW-456 > URL: http://issues.apache.org/struts/browse/WW-456 > Project: Struts 2 > Issue Type: Bug > Components: Actions > Affects Versions: WW 1.4, WW 1.3 > Reporter: Attila Szegedi > Fix For: WW 1.4.1 > > > SingleValueMap.entrySet() returns multivalue entries instead of single value > ones. There's a "//TODO: NYI" comment in there... > Here's a patch that makes it right, coded to be similar to how values() is > implemented: > public Set entrySet() > { > Set entries = m.entrySet(); > Set realEntries = new HashSet(entries.size() * 4/3, .75f); > for (Iterator iterator = entries.iterator(); iterator.hasNext();) > { > realEntries.add(new SingleValueEntry((Map.Entry)iterator.next())); > } > return realEntries; > } > > private static class SingleValueEntry implements Map.Entry > { > private final Map.Entry entry; > > SingleValueEntry(Map.Entry entry) > { > this.entry = entry; > } > public Object getKey() > { > return entry.getKey(); > } > > public Object getValue() > { > Object o = entry.getValue(); > return o == null ? null : ((Object[])o)[0]; > } > > public void setValue(Object value) > { > Object o = entry.getValue(); > if(o instanceof Object[]) > { > Object[] ao = (Object[])o; > if(ao.length > 0) > { > ao[0] = value; > return; > } > } > entry.setValue(new Object[] { value }); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
