Hi,
I get a java.util.ConcurrentModificationException (see below) when using the
CasDumpWriter in the following way:
import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine;
import org.apache.uima.UIMAException;
import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.fit.component.CasDumpWriter;
import org.apache.uima.fit.factory.JCasFactory;
import org.apache.uima.jcas.JCas;
import org.junit.Test;
public class CasDumpWriterTest {
@Test
public final void testDump() throws UIMAException {
// Set up the CAS
JCas jcas = JCasFactory.createJCas();
JCas view = jcas.createView("testview");
view.setDocumentText("test");
AnalysisEngine dump = createEngine(CasDumpWriter.class, //
CasDumpWriter.PARAM_OUTPUT_FILE, "target/cas-dump.txt");
dump.process(jcas);
}
}
Is there anything I am doing wrong? How can I use the CasDumpWriter without
causing this exception? I am using UIMA 2.9.0 and uimafit 2.2.0, but the same
also happens with 2.3.0. This definitely worked with earlier version of UIMA.
If this is not the write channel to ask this question, please let me know.
Thank you!
Best regards, Miriam
Output:
Jun 30, 2017 5:12:31 PM
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl
callAnalysisComponentProcess(430)
SEVERE: Exception occurred
org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator
processing failed.
at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:412)
at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:314)
at
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:269)
at
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:284)
at
com.sap.gs.hlt.mt.pipelines.de.nmt.CasDumpWriterTest.testDump(CasDumpWriterTest.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.util.ConcurrentModificationException
at
org.apache.uima.cas.impl.FSIntIteratorImplBase.checkConcurrentModification(FSIntIteratorImplBase.java:67)
at
org.apache.uima.cas.impl.IntIterator4bag.get(IntIterator4bag.java:79)
at
org.apache.uima.cas.impl.FSIteratorWrapper.get(FSIteratorWrapper.java:63)
at
org.apache.uima.cas.impl.FSIteratorImplBase.next(FSIteratorImplBase.java:66)
at
org.apache.uima.cas.impl.FSIteratorImplBase.next(FSIteratorImplBase.java:32)
at org.apache.uima.cas.impl.CASImpl$1.next(CASImpl.java:5104)
at org.apache.uima.cas.impl.CASImpl$1.next(CASImpl.java:5077)
at
org.apache.uima.fit.component.CasDumpWriter.process(CasDumpWriter.java:151)
at
org.apache.uima.analysis_component.CasAnnotator_ImplBase.process(CasAnnotator_ImplBase.java:56)
at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:396)
... 27 more