You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by se...@apache.org on 2019/01/22 22:09:07 UTC
svn commit: r1851869 -
/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/CalendarUtil.java
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 ) {