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 2013/06/04 14:14:28 UTC

svn commit: r1489402 - /uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java

Author: pkluegl
Date: Tue Jun  4 12:14:28 2013
New Revision: 1489402

URL: http://svn.apache.org/r1489402
Log:
no jira - HtmlCoverter: check offsets of converted annotation

Modified:
    uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java

Modified: uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java?rev=1489402&r1=1489401&r2=1489402&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java (original)
+++ uima/sandbox/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlConverter.java Tue Jun  4 12:14:28 2013
@@ -305,11 +305,16 @@ public class HtmlConverter extends JCasA
         if (mappedEnd > fromJcas.getCas().getDocumentAnnotation().getEnd()) {
           getContext().getLogger().log(Level.WARNING, "illegal annotation offset mapping");
         } else {
-          clone.setBegin(mappedBegin);
-          clone.setEnd(mappedEnd);
-          // TODO handle nested annotation features
-          modview.addFsToIndexes(clone);
-          indexedFs.add(clone);
+          int max = modview.getCas().getDocumentAnnotation().getEnd();
+          if (mappedBegin < max && mappedEnd <= max && mappedBegin >= 0 && mappedEnd > 0) {
+            clone.setBegin(mappedBegin);
+            clone.setEnd(mappedEnd);
+            // TODO handle nested annotation features
+            modview.addFsToIndexes(clone);
+            indexedFs.add(clone);
+          } else {
+            getContext().getLogger().log(Level.WARNING, "illegal annotation offset mapping");
+          }
         }
       }
     }