uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: CPM class usage
Date Wed, 03 Feb 2010 12:00:08 GMT
Radwen ANIBA wrote:
> Hello,
>
> I have devoloped a serie of AEs that I tested through CPE GUI,and now I'm
> trying to write a java aplication using these AEs and trying to do th same
> thing as CPE GUI. So I took as reference SimpleRunCPM example and I made
> these changes
>
>  // create a new Collection Processing Manager
>     mCPM = UIMAFramework.newCollectionProcessingManager();
>
>     // Register AE and CAS Consumer with the CPM
>     mCPM.setAnalysisEngine(ae1);
>     mCPM.setAnalysisEngine(ae2);
>     mCPM.setAnalysisEngine(ae3);
>     mCPM.setAnalysisEngine(ae4);
>
> Notice here I have 4 ae and not only one
>
> So when running this I have an error message in mCPM.setAnalysisEngine(ae2)
> saying
>
> Initializing AnalysisEngines
> Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0,
> Size: 0
>     at java.util.LinkedList.entry(LinkedList.java:365)
>     at java.util.LinkedList.remove(LinkedList.java:357)
>     at
> org.apache.uima.collection.impl.cpm.engine.CPMEngine.removeCasProcessor(CPMEngine.java:1188)
>     at
> org.apache.uima.collection.impl.cpm.BaseCPMImpl.removeCasProcessor(BaseCPMImpl.java:361)
>     at
> org.apache.uima.collection.impl.cpm.CPMImpl.setAnalysisEngine(CPMImpl.java:70)
>
> So I don't know what is really the problem, if CPM do not take up to one ae
> or this is a problem in ae2 that I already tried without any bug.
>   

Looking at the code, it appears that the CPMImpl class has two different
approaches for managing Analysis Engines AE.  One approach assumes there
is only one AE.  This approach is used with methods like
setAnalysisEngine, getAnalysisEngine, etc.  These set and remove the one
(and only) AE.  If you try and set more than one AE, the previously set
AE is removed, and the next AE is substituted for it, which is not what
you are trying to do, of course.

There are other methods that permit multiple analysis engines.  These
are methods like addCasProcessor.

Try changing setAnalysisEngine to addCasProcessor.

The error stack trace reveals this part of the framework code is buggy. 
I'll submit a bug report.

-Marshall

> Any idea ?
>
> Thx
>
> Rad
>
>   

Mime
View raw message