You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2020/10/21 06:44:16 UTC

[uima-uimaj] branch bugfix/UIMA-6282-select.at-may-fail-to-respect-bounds created (now 8723c73)

This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch bugfix/UIMA-6282-select.at-may-fail-to-respect-bounds
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


      at 8723c73  [UIMA-6282] select.at() may fail to respect bounds

This branch includes the following new commits:

     new 8723c73  [UIMA-6282] select.at() may fail to respect bounds

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimaj] 01/01: [UIMA-6282] select.at() may fail to respect bounds

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch bugfix/UIMA-6282-select.at-may-fail-to-respect-bounds
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit 8723c73032105712c028403a5a67b6abaf97a84d
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Wed Oct 21 08:43:58 2020 +0200

    [UIMA-6282] select.at() may fail to respect bounds
    
    - Respect bounds when skipping over the bounding annotation
---
 .../main/java/org/apache/uima/cas/impl/Subiterator.java |  2 +-
 .../java/org/apache/uima/cas/impl/SelectFsTest.java     | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
index d77fa3e..6969ed3 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
@@ -437,7 +437,7 @@ public class Subiterator<T extends AnnotationFS> implements LowLevelIterator<T>
         // skip over bounding annotation
         while (equalToBounds(it.getNvc())) {
           it.moveToNextNvc();
-          if (!it.isValid()) {
+          if (is_beyond_bounds_chk_sameBeginEnd()) {
             return;
           }
         }
diff --git a/uimaj-core/src/test/java/org/apache/uima/cas/impl/SelectFsTest.java b/uimaj-core/src/test/java/org/apache/uima/cas/impl/SelectFsTest.java
index b2089a9..7f29d57 100644
--- a/uimaj-core/src/test/java/org/apache/uima/cas/impl/SelectFsTest.java
+++ b/uimaj-core/src/test/java/org/apache/uima/cas/impl/SelectFsTest.java
@@ -19,6 +19,8 @@
 
 package org.apache.uima.cas.impl;
 
+import static java.lang.Integer.MAX_VALUE;
+import static java.util.Arrays.asList;
 import static java.util.stream.Collectors.toList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertEquals;
@@ -299,4 +301,19 @@ public class SelectFsTest  {
 
     assertThat(result).containsExactly(a1, a2, a3);
   }
+  
+  /**
+   * @see <a href="https://issues.apache.org/jira/browse/UIMA-6282">UIMA-6282</a>
+   */
+  @Test
+  public void thatSelectAtDoesNotFindFollowingAnnotation()
+  {
+    cas.reset();
+    AnnotationFS a1 = cas.createAnnotation(cas.getAnnotationType(), 10, 20);
+    AnnotationFS a2 = cas.createAnnotation(cas.getAnnotationType(), 21, MAX_VALUE);
+    
+    asList(a1, a2).forEach(cas::addFsToIndexes);
+    
+    assertThat(cas.<Annotation>select(cas.getAnnotationType()).at(a1).asList().contains(a2)).isFalse();
+  }
 }