You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (JIRA)" <de...@uima.apache.org> on 2016/09/09 17:48:23 UTC

[jira] [Updated] (UIMA-1732) CPM setAnalysisEngine throws IndexOutOfBounds

     [ https://issues.apache.org/jira/browse/UIMA-1732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Eckart de Castilho updated UIMA-1732:
---------------------------------------------
    Labels: Stale  (was: )

This issue is marked as "stale" due to inactivity for 5 years or longer. If no further activity is detected on this issue, it is scheduled be closed as 'unresolved' in 3 months time from now (Dec 2016).

> CPM setAnalysisEngine throws IndexOutOfBounds
> ---------------------------------------------
>
>                 Key: UIMA-1732
>                 URL: https://issues.apache.org/jira/browse/UIMA-1732
>             Project: UIMA
>          Issue Type: Bug
>          Components: Collection Processing
>    Affects Versions: 2.3
>            Reporter: Marshall Schor
>            Assignee: Jerry Cwiklik
>            Priority: Minor
>              Labels: Stale
>
> A user tried to do several calls to aCPM.setAnalysisEngine(xxx).  This method is set up to remove a previous AE if it exists, replacing it with the new one.
> See http://markmail.org/message/3s2w7hxb24l3czky
> There are several issues:
> The method CPMEngine removeCasProcessor(int aCasProcessorIndex) has a bad bounds test, need to change
> {noformat}
>     if (aCasProcessorIndex < 0 || aCasProcessorIndex > annotatorList.size())  to
>     if (aCasProcessorIndex < 0 || aCasProcessorIndex >= annotatorList.size())
> {noformat} 
> The CPMEngine class uses two different collections to represent lists of analysis engines:
> *  casprocessorList (an array - includes AEs and Cas Consumers)
> * annotatorList (a linked list, not sure if it has both AEs and Cas Consumers)
> The CPMImpl setAnalysisEngine seems to have set something which shows up in the array from getCasProcessors call, while the "annotatorList" is not updated and remains empty.
> This method:
> {noformat}
>   public void removeCasProcessor(CasProcessor aCasProcessor) { 
>     cpEngine.removeCasProcessor(0);
>   }
> {noformat}
>  
> ignores its argument, and removes the 0'th CasProcessor.  This seems wrong, given the Javadoc.
> The Javadoc for setAnalysisEngine's javadoc should emphasize that this is a convenience method for the common case of supporting a single AE. If it is called multiple times, it will replace the first AE (if it exists) .  The Javadocs should be expanded to say if you want to add multiple AEs to a pipe line, to not use this method, but use addCasProcessor instead. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)