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 2015/08/06 13:16:44 UTC

svn commit: r1694453 - /uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java

Author: pkluegl
Date: Thu Aug  6 11:16:43 2015
New Revision: 1694453

URL: http://svn.apache.org/r1694453
Log:
UIMA-4549
-avoid NPE when removing a not up-to-date annotation concerning partitioning

Modified:
    uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java

Modified: uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java?rev=1694453&r1=1694452&r2=1694453&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java (original)
+++ uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java Thu Aug  6 11:16:43 2015
@@ -340,8 +340,12 @@ public class RutaStream extends FSIterat
     Type parent = type;
     RutaBasic beginAnchor = getBeginAnchor(annotation.getBegin());
     RutaBasic endAnchor = getEndAnchor(annotation.getEnd());
-    beginAnchor.removeBegin(annotation, parent);
-    endAnchor.removeEnd(annotation, parent);
+    if(beginAnchor != null) {
+    	beginAnchor.removeBegin(annotation, parent);
+    }
+    if(endAnchor != null) {
+    	endAnchor.removeEnd(annotation, parent);
+    }
     if (!(annotation instanceof RutaBasic)) {
       cas.removeFsFromIndexes(annotation);
     }
@@ -530,7 +534,7 @@ public class RutaStream extends FSIterat
       return Collections.emptySet();
     }
     RutaBasic beginAnchor = getBeginAnchor(windowAnnotation.getBegin());
-    if (beginAnchor.getEnd() == windowAnnotation.getEnd()) {
+    if (beginAnchor != null && beginAnchor.getEnd() == windowAnnotation.getEnd()) {
       Collection<RutaBasic> result = new ArrayList<RutaBasic>(1);
       result.add(beginAnchor);
       return result;