You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2022/01/14 16:30:31 UTC

[uima-ruta] branch bugfix/UIMA-6411-Ruta-avoid-creation-of-RutaBasics-for-bad-annotations created (now d9b3321)

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

pkluegl pushed a change to branch bugfix/UIMA-6411-Ruta-avoid-creation-of-RutaBasics-for-bad-annotations
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git.


      at d9b3321  UIMA-6411: Ruta: avoid creation of RutaBasics for bad annotations

This branch includes the following new commits:

     new d9b3321  UIMA-6411: Ruta: avoid creation of RutaBasics for bad annotations

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-ruta] 01/01: UIMA-6411: Ruta: avoid creation of RutaBasics for bad annotations

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

pkluegl pushed a commit to branch bugfix/UIMA-6411-Ruta-avoid-creation-of-RutaBasics-for-bad-annotations
in repository https://gitbox.apache.org/repos/asf/uima-ruta.git

commit d9b33219716517ba915c92177b0690e0814486a9
Author: Peter Klügl <pe...@averbis.com>
AuthorDate: Fri Jan 14 17:30:20 2022 +0100

    UIMA-6411: Ruta: avoid creation of RutaBasics for bad annotations
    
    - adding test
---
 .../java/org/apache/uima/ruta/EmptyDocumentTest.java     | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/EmptyDocumentTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/EmptyDocumentTest.java
index 4476a55..ea779c8 100644
--- a/ruta-core/src/test/java/org/apache/uima/ruta/EmptyDocumentTest.java
+++ b/ruta-core/src/test/java/org/apache/uima/ruta/EmptyDocumentTest.java
@@ -23,12 +23,15 @@ import static org.junit.Assert.assertEquals;
 
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.SelectFSs;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.cas.text.AnnotationIndex;
 import org.apache.uima.ruta.engine.Ruta;
 import org.apache.uima.ruta.engine.RutaEngine;
 import org.apache.uima.ruta.engine.RutaTestUtils;
 import org.apache.uima.ruta.rule.RuleInference1Test;
+import org.apache.uima.ruta.type.RutaBasic;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class EmptyDocumentTest {
@@ -62,4 +65,17 @@ public class EmptyDocumentTest {
     RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "");
   }
 
+  @Test
+  public void testSpaceWithInvalidAnnotation() throws Exception {
+    CAS cas = RutaTestUtils.getCAS(" ");
+    cas.createAnnotation(cas.getAnnotationType(), -1, 1);
+    Ruta.apply(cas, "Document;");
+
+    SelectFSs<RutaBasic> select = cas.select(RutaBasic.class);
+    Assert.assertEquals(1, select.count());
+    RutaBasic rutaBasic = select.findAny().get();
+    Assert.assertEquals(0, rutaBasic.getBegin());
+    Assert.assertEquals(1, rutaBasic.getEnd());
+  }
+
 }