You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (Jira)" <de...@uima.apache.org> on 2021/03/15 17:41:00 UTC

[jira] [Created] (UIMA-6342) Moving iterator beyond bounds does not invalidate it

Richard Eckart de Castilho created UIMA-6342:
------------------------------------------------

             Summary: Moving iterator beyond bounds does not invalidate it
                 Key: UIMA-6342
                 URL: https://issues.apache.org/jira/browse/UIMA-6342
             Project: UIMA
          Issue Type: Bug
          Components: UIMA
            Reporter: Richard Eckart de Castilho
            Assignee: Richard Eckart de Castilho
             Fix For: 3.2.0SDK


{code}
  @Test
  public void thatSeekingIteratorToOutOfIndexPositionOnRightIsInvalid() throws Exception {
    TypeSystemDescription tsd = getResourceSpecifierFactory().createTypeSystemDescription();
    tsd.addType("test.Type1", "", CAS.TYPE_NAME_ANNOTATION);
    tsd.addType("test.Type2", "", CAS.TYPE_NAME_ANNOTATION);
    tsd.addType("test.Type3", "", CAS.TYPE_NAME_ANNOTATION);
    
    CAS cas = CasCreationUtils.createCas(tsd, null, null, null);
    
    Type type1 = cas.getTypeSystem().getType("test.Type1");
    Type type2 = cas.getTypeSystem().getType("test.Type2");
    Type type3 = cas.getTypeSystem().getType("test.Type3");
    
    AnnotationFS window, seekPoint;
    addToIndexes(
            window = cas.createAnnotation(type1, 0, 10),
            cas.createAnnotation(type2, 5, 6),
            seekPoint = cas.createAnnotation(type3, 8, 9),
            cas.createAnnotation(type2, 15, 16));
    
    FSIterator<AnnotationFS> it = cas.getAnnotationIndex(type2).select().coveredBy(window).fsIterator();
    
    it.moveTo(seekPoint);
    // Iterator should be invalid at this point because the insertion points is right of [5,6]
    assertThat(it.isValid()).isFalse();
  }
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)