add LOG capability to ErrorAnnotator for testing suppressing logging
package org.apache.uima.analysis_engine.impl;
import org.apache.uima.analysis_engine.ResultSpecification;
+import org.apache.uima.analysis_engine.annotator.AnnotatorContextException;
import org.apache.uima.analysis_engine.annotator.AnnotatorProcessException;
import org.apache.uima.analysis_engine.annotator.Annotator_ImplBase;
import org.apache.uima.analysis_engine.annotator.TextAnnotator;
@@ -37,5 +38,13 @@ public class ErrorAnnotator extends Annotator_ImplBase implements TextAnnotator
if ("ERROR".equals(aCAS.getDocumentText())) {
throw new RuntimeException("Test Error");
}
+
+ if ("LOG".equals(aCAS.getDocumentText())) {
+ try {
+ getContext().getLogger().warn("Test Warn Log");
+ } catch (AnnotatorContextException e) {
+ throw new RuntimeException("Internal test failure");
+ }
+ }
}
}
