commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (COLLECTIONS-447) TreeListIterator can return incorrect results after remove() is called
Date Mon, 04 Mar 2013 20:21:12 GMT

     [ https://issues.apache.org/jira/browse/COLLECTIONS-447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Neidhart resolved COLLECTIONS-447.
-----------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.0

Applied the patch together with some additional comment in r1452481.

Thanks for the analysis and patch, this was really a tricky one!
                
> TreeListIterator can return incorrect results after remove() is called
> ----------------------------------------------------------------------
>
>                 Key: COLLECTIONS-447
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-447
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>    Affects Versions: Nightly Builds
>         Environment: Windows 7, jdk1.5.0_22
>            Reporter: Jeffrey Barnes
>              Labels: patch, test
>             Fix For: 4.0
>
>         Attachments: fix.patch, testcase.patch
>
>
> {{TreeList.TreeListIterator}} can get in a bad state when {{remove()}} is called, causing
it to subsequently return incorrect results. This is because {{TreeListIterator}} caches an
{{AVLNode}} reference in its field {{next}}, and this node reference may become stale when
{{remove()}} is called (it may contain a reference to a node that no longer exists in the
tree).
> I will attach two patches: {{testcase.patch}} will contain a test case illustrating the
bug, and {{fix.patch}} will contain a fix. (To fix the bug, I simply clear the cached {{next}}
value in {{TreeListIterator.remove}}.)
> This was originally reported in a comment to COLLECTIONS-433; I am creating a separate
issue for this at Thomas Neidhart's suggestion.

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