[ 
https://issues.apache.org/jira/browse/UIMA-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12516417
 ] 

Marshall Schor commented on UIMA-519:
-------------------------------------

This does look like a simple bug: an iterater in a loop not incrementing the 
iterator - so it goes on forever...

The fix suggested seems OK; it uses the plain iterator idioms.

The hard thing about fixing this is the test case that needs to be written.  I 
think there are no tests covering AnnotationTree at the moment.  

> Infinite Loop in AnnotationIndexImpl tree()
> -------------------------------------------
>
>                 Key: UIMA-519
>                 URL: https://issues.apache.org/jira/browse/UIMA-519
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.1
>         Environment: Windows XP Professional, Java 1.6.0_01-b06, Building and 
> running in Eclipse 3.3 with Java 5.0 compliance.
>            Reporter: Matthew Campbell
>
> There seems to be an infinite loop within the AnnotationIndexImpl 
> addChildren() method, called by the tree() method.  The subiterator that is 
> passed in doesn't seem to be pushed to the next value, and so it just sits 
> and loops forever.  I changed the loop to the code below and it seems to 
> solve the problem.
> while (it.hasNext()) {
>     annot = (AnnotationFS) it.next();
>     dtr = new AnnotationTreeNodeImpl();
>     dtr.set(annot);
>     node.addChild(dtr);
>     addChildren(dtr, subiterator(annot));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to