Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-1732

CPM setAnalysisEngine throws IndexOutOfBounds

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Abandoned
    • 2.3
    • None
    • Collection Processing

    Description

      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

          if (aCasProcessorIndex < 0 || aCasProcessorIndex > annotatorList.size())  to
          if (aCasProcessorIndex < 0 || aCasProcessorIndex >= annotatorList.size())
      

      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:

        public void removeCasProcessor(CasProcessor aCasProcessor) { 
          cpEngine.removeCasProcessor(0);
        }
      

      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.

      Attachments

        Activity

          People

            cwiklik Jaroslaw Cwiklik
            schor Marshall Schor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: