commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ning Chen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-474) Exception in ListOrderedMap
Date Mon, 24 Jun 2013 19:40:20 GMT

    [ https://issues.apache.org/jira/browse/COLLECTIONS-474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13692299#comment-13692299
] 

Ning Chen commented on COLLECTIONS-474:
---------------------------------------

Wow! Thanks for the quick responses! 

Just to make sure, after applying the patch, is the "index == size" case considered in-range
(no exception raised)? 

FYI, it is also possible to reproduce the exception even when "index < size": 
    Object key1 = new Object();
    Object key2 = new Object();
    Object key3 = new Object();
    HashMap<Object, Object> map = new HashMap<Object, Object>();
    map.put(key1, null);
    map.put(key2, null);
    map.put(key3, null);

    ListOrderedMap<Object, Object> listMap = new ListOrderedMap<Object, Object>();
    listMap.put(key1, null);
    listMap.put(key2, null);
    listMap.put(key3, null);
    listMap.putAll(2, map);
                
> Exception in ListOrderedMap
> ---------------------------
>
>                 Key: COLLECTIONS-474
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-474
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 4.0
>         Environment: java 1.7.0_09
>            Reporter: Ning Chen
>         Attachments: Test.java
>
>
> Dear apache developers, thanks for the great project. Recently, I encountered an IndexOutOfBoundsException
in ListOrderedMap in the latest revision (r1495998) with the crash stack trace: 
> Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 1
> 	at java.util.ArrayList.add(ArrayList.java:367)
> 	at org.apache.commons.collections4.map.ListOrderedMap.put(ListOrderedMap.java:448)
> 	at org.apache.commons.collections4.map.ListOrderedMap.putAll(ListOrderedMap.java:246)
> 	at Test.main(Test.java:15)
> I've also attached a test case that can reproduce this crash.
> I think this test case actually reveals the bug reported in COLLECTIONS-411 (https://issues.apache.org/jira/browse/COLLECTIONS-411).
However, it seems that the original patch for COLLECTIONS-411 missed a corner case.
> Could you please check if this is indeed a bug? Thanks!

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message