ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1771027 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/regex/RegexSpanFinder.java
Date Wed, 23 Nov 2016 19:00:22 GMT
Author: seanfinan
Date: Wed Nov 23 19:00:22 2016
New Revision: 1771027

URL: http://svn.apache.org/viewvc?rev=1771027&view=rev
Log:
bounds check for matcher

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/regex/RegexSpanFinder.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/regex/RegexSpanFinder.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/regex/RegexSpanFinder.java?rev=1771027&r1=1771026&r2=1771027&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/regex/RegexSpanFinder.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/regex/RegexSpanFinder.java
Wed Nov 23 19:00:22 2016
@@ -156,7 +156,10 @@ final public class RegexSpanFinder imple
          final Matcher matcher = __pattern.matcher( __text );
          while ( matcher.find() && !Thread.currentThread().isInterrupted() ) {
             final Pair<Integer> bounds = new Pair<>( matcher.start(), matcher.end()
);
-            listBounds.add( bounds );
+            if ( bounds.getValue1() >= 0 && bounds.getValue2() > bounds.getValue1()
&&
+                 bounds.getValue2() <= __text.length() ) {
+               listBounds.add( bounds );
+            }
          }
          return listBounds;
       }



Mime
View raw message