This is an automated email from the ASF dual-hosted git repository.
seanfinan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ctakes.git
The following commit(s) were added to refs/heads/main by this push:
new 7370cf5 Fix for collection readers that don't init cas / type system.
7370cf5 is described below
commit 7370cf54ccc6c479038b14ea93223be50e950222
Author: Sean Finan <[email protected]>
AuthorDate: Fri Aug 23 09:19:52 2024 -0400
Fix for collection readers that don't init cas / type system.
---
.../org/apache/ctakes/core/cr/AbstractFileTreeReader.java | 4 ++--
.../org/apache/ctakes/core/pipeline/PiperFileRunner.java | 15 +++++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/cr/AbstractFileTreeReader.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/cr/AbstractFileTreeReader.java
index f992ad8..75ed46a 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/cr/AbstractFileTreeReader.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/cr/AbstractFileTreeReader.java
@@ -184,10 +184,10 @@ abstract public class AbstractFileTreeReader extends
JCasCollectionReader_ImplBa
// Workaround https://github.com/apache/uima-uimaj/issues/234
// https://github.com/ClearTK/cleartk/issues/470
try {
- LOGGER.info( "Creating empty CAS to make certain that the typesystem
is initialized ..." );
+ LOGGER.debug( "Creating empty CAS to make certain that the typesystem
is initialized ..." );
CasCreationUtils.createCas();
} catch ( ResourceInitializationException riE ) {
- LOGGER.error( "Could not create base CAS for initialization.\n" +
riE.getMessage() );
+ LOGGER.error( "Could not create base CAS for initialization.\n{}",
riE.getMessage() );
LOGGER.error( Arrays.stream( riE.getStackTrace() )
.map( StackTraceElement::toString )
.collect( Collectors.joining("\n" ) ) );
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
index 95347d0..60abe2a 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
@@ -3,6 +3,8 @@ package org.apache.ctakes.core.pipeline;
import com.lexicalscope.jewel.cli.CliFactory;
import org.apache.ctakes.core.config.ConfigParameterConstants;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.CasCreationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.uima.UIMAException;
@@ -11,6 +13,8 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.stream.Collectors;
/**
* @author SPF , chip-nlp
@@ -79,6 +83,17 @@ final public class PiperFileRunner {
builder.writeHtml( htmlOutDir );
}
}
+ // Workaround https://github.com/apache/uima-uimaj/issues/234
+ // https://github.com/ClearTK/cleartk/issues/470
+ try {
+ LOGGER.debug( "Creating empty CAS to make certain that the
typesystem is initialized ..." );
+ CasCreationUtils.createCas();
+ } catch ( ResourceInitializationException riE ) {
+ LOGGER.error( "Could not create base CAS for initialization.\n{}",
riE.getMessage() );
+ LOGGER.error( Arrays.stream( riE.getStackTrace() )
+ .map( StackTraceElement::toString )
+ .collect( Collectors.joining("\n" ) ) );
+ }
// run the pipeline
builder.run();
} catch ( UIMAException | IOException multE ) {