[ 
https://issues.apache.org/jira/browse/UIMA-5812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16541790#comment-16541790
 ] 

Marshall Schor commented on UIMA-5812:
--------------------------------------

taking a look...

> CPMEngine's getCasProcessors() messes up the ae engines order
> -------------------------------------------------------------
>
>                 Key: UIMA-5812
>                 URL: https://issues.apache.org/jira/browse/UIMA-5812
>             Project: UIMA
>          Issue Type: Bug
>          Components: UIMA
>    Affects Versions: 2.10.0SDK, 2.10.2SDK, 3.0.0SDK, 2.10.3SDK
>         Environment: Ubuntu18.04, Java(TM) SE Runtime Environment (build 
> 1.8.0_151-b12)
>            Reporter: Jianlin Shi
>            Priority: Major
>
> In the current code:
> {quote}  ArrayList aList = new ArrayList();
>     Iterator keyIt = analysisEngines.keySet().iterator();
>     while (keyIt.hasNext()) {
>       String keyName = (String) keyIt.next();
>       List kList = (List) analysisEngines.get(keyName);
>       if (kList != null) {
>         for (int i = 0; i < kList.size(); i++) {
>           aList.add(kList.get(i));
>         }
>       }
>     }
>     keyIt = consumers.keySet().iterator();
>     while (keyIt.hasNext()) {
>       String keyName = (String) keyIt.next();
>       List kList = (List) consumers.get(keyName);
>       if (kList != null) {
>         for (int i = 0; i < kList.size(); i++) {
>           aList.add(kList.get(i));
>         }
>       }
> }
> {quote}
> While analysisEngines and consumers are both Hashtables, iterating through 
> the keys won't preserve the order.
> Suggest to use the following instead: 
> {quote}        ArrayList aList = new ArrayList();
>         for(Object annotator:this.annotatorDeployList){
>             List kList = (List) annotator;
>             if (kList != null) {
>                 for (int i = 0; i < kList.size(); i++) {
>                     aList.add(kList.get(i));
>                 }
>             }
>         }
>         for(Object annotator:this.consumerDeployList){
>             List kList = (List) annotator;
>             if (kList != null) {
>                 for (int i = 0; i < kList.size(); i++) {
>                     aList.add(kList.get(i));
>                 }
>             }
>         }
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to