ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1851869 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/CalendarUtil.java
Date Tue, 22 Jan 2019 22:09:07 GMT
Author: seanfinan
Date: Tue Jan 22 22:09:07 2019
New Revision: 1851869

URL: http://svn.apache.org/viewvc?rev=1851869&view=rev
Log:
Catch rte from jchronic

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/CalendarUtil.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/CalendarUtil.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/CalendarUtil.java?rev=1851869&r1=1851868&r2=1851869&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/CalendarUtil.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/CalendarUtil.java
Tue Jan 22 22:09:07 2019
@@ -9,6 +9,7 @@ import org.apache.ctakes.core.util.Strin
 import org.apache.ctakes.typesystem.type.refsem.Date;
 import org.apache.ctakes.typesystem.type.textsem.DateAnnotation;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
+import org.apache.log4j.Logger;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
 
@@ -141,11 +142,16 @@ final public class CalendarUtil {
     * @return Calendar parsed from text, or {@link #NULL_CALENDAR}.
     */
    static public Calendar getCalendar( final String text ) {
-      final Span span = Chronic.parse( text, PAST_OPTIONS );
-      if ( span == null ) {
+      try {
+         final Span span = Chronic.parse( text, PAST_OPTIONS );
+         if ( span == null ) {
+            return NULL_CALENDAR;
+         }
+         return span.getEndCalendar();
+      } catch ( RuntimeException rtE ) {
+         Logger.getLogger( "CalendarUtil" ).error( rtE.getMessage() );
          return NULL_CALENDAR;
       }
-      return span.getEndCalendar();
    }
 
    static public Calendar getTextCalendar( final String text ) {



Mime
View raw message