Author: pkluegl
Date: Fri Dec 21 13:39:22 2018
New Revision: 1849474

URL: http://svn.apache.org/viewvc?rev=1849474&view=rev
Log:
UIMA-5863: reassign only if there was a match

Modified:
    
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/PlusGreedy.java
    
uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationFeatureExpressionTest.java

Modified: 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/PlusGreedy.java
URL: 
http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/PlusGreedy.java?rev=1849474&r1=1849473&r2=1849474&view=diff
==============================================================================
--- 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/PlusGreedy.java
 (original)
+++ 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/rule/quantifier/PlusGreedy.java
 Fri Dec 21 13:39:22 2018
@@ -48,8 +48,11 @@ public class PlusGreedy extends Abstract
       result &= match.matched();
     }
     if (!result && matches.size() > 1) {
+      RuleElementMatch ruleElementMatch = matches.get(matches.size() - 1);
       matches.remove(matches.size() - 1);
-      updateLabelAssignment(matches, context, stream);
+      if (!ruleElementMatch.getTextsMatched().isEmpty()) {
+        updateLabelAssignment(matches, context, stream);
+      }
       result = true;
     }
     if (matches.size() < 1 || allEmpty) {

Modified: 
uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationFeatureExpressionTest.java
URL: 
http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationFeatureExpressionTest.java?rev=1849474&r1=1849473&r2=1849474&view=diff
==============================================================================
--- 
uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationFeatureExpressionTest.java
 (original)
+++ 
uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationFeatureExpressionTest.java
 Fri Dec 21 13:39:22 2018
@@ -259,8 +259,6 @@ public class AnnotationFeatureExpression
     CAS cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
     Ruta.apply(cas, script);
 
-    RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "Some");
-
   }
 
 }


Reply via email to