You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2019/12/05 16:14:00 UTC
[jira] [Resolved] (COLLECTIONS-734) Encountered an
IllegalStateException while traversing with Flat3Map.entrySet()
[ https://issues.apache.org/jira/browse/COLLECTIONS-734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory resolved COLLECTIONS-734.
-----------------------------------------
Fix Version/s: 4.5
Resolution: Fixed
A slightly different patch for the test is now in git master. Please verify and close.
> Encountered an IllegalStateException while traversing with Flat3Map.entrySet()
> -------------------------------------------------------------------------------
>
> Key: COLLECTIONS-734
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-734
> Project: Commons Collections
> Issue Type: Bug
> Components: Map
> Affects Versions: 3.0
> Reporter: Chen
> Priority: Major
> Fix For: 4.5
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Encountered an IllegalStateException while traversing with Flat3Map.entrySet()
> {code:java}
> //代码示例
> public void testEntrySet() {
> final Flat3Map<Integer, String> map = new Flat3Map<>();
> map.put(1, "A");
> map.put(2, "B");
> map.put(3, "C");
> Iterator<Map.Entry<Integer, String>> it = map.entrySet().iterator(); Map.Entry<Integer, String> mapEntry1 = it.next();
> Map.Entry<Integer, String> mapEntry2 = it.next();
> Map.Entry<Integer, String> mapEntry3 = it.next();
> it.remove(); assertEquals(2, map.size());
> }
> {code}
> Using the above code will generate an IllegalStateException.
> The reason for this problem is that there is a problem with the EntryIterator.remove() method in the Flat3Map java class.
> I submitted a [PR|https://github.com/apache/commons-collections/pull/115](https://github.com/apache/commons-collections/pull/115) to fix this bug.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)