ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1813312 - in /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline: PiperFileReader.java PiperFileRunner.java
Date Wed, 25 Oct 2017 15:00:20 GMT
Author: seanfinan
Date: Wed Oct 25 15:00:20 2017
New Revision: 1813312

URL: http://svn.apache.org/viewvc?rev=1813312&view=rev
Log:
CTAKES-470 : throw exception (and exit) if piper cannot be loaded.  Exceptions saved to log
file.

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java?rev=1813312&r1=1813311&r2=1813312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
Wed Oct 25 15:00:20 2017
@@ -154,7 +154,8 @@ final public class PiperFileReader {
          }
       } catch ( IOException ioE ) {
          LOGGER.error( "Could not read piper file: " + filePath );
-         return false;
+//         return false;
+         throw new UIMAException( ioE );
       }
       return true;
    }

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java?rev=1813312&r1=1813311&r2=1813312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
Wed Oct 25 15:00:20 2017
@@ -6,7 +6,10 @@ import org.apache.ctakes.core.config.Con
 import org.apache.log4j.Logger;
 import org.apache.uima.UIMAException;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.Paths;
 
 /**
  * @author SPF , chip-nlp
@@ -68,7 +71,16 @@ final public class PiperFileRunner {
          // run the pipeline
          builder.run();
       } catch ( UIMAException | IOException multE ) {
-         LOGGER.error( multE.getMessage(), multE );
+         LOGGER.error( multE.getMessage() );
+         final String logPath = Paths.get( "cTAKES.error.log" ).toFile().getAbsolutePath();
+         try {
+            final PrintStream stream = new PrintStream( logPath );
+            multE.printStackTrace( stream );
+            LOGGER.info( "For more information please see log file " + logPath );
+         } catch ( FileNotFoundException fnfE ) {
+            LOGGER.warn( "Could not write to log file " + logPath );
+            multE.printStackTrace();
+         }
          return false;
       }
       return true;



Mime
View raw message