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

Position lost on FSIterator copy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.0SDK
    • Core Java Framework
    • None

    Description

      Apparently, in some cases, a FSIterator becomes invalid/looses its position after a copy(). Unfortunately, I haven't been able to quickly create a plain UIMA test case (I tried reproducing the effect in GetAllIndexedTest, but couldn't.

      So the following snipped is works (fails) when pasted into the uimaFIT CasUtilTest after upgrading uimaFIT to 2.8.0 RC 1:

        @Test
        public void lala() throws Exception {
          String text = "Rot wood cheeses dew?";
          tokenBuilder.buildTokens(jCas, text);
      
          CAS cas = jCas.getCas();
          // Option 1: remove the ".copy()"
          FSIterator<FeatureStructure> fses = cas.getIndexRepository()
                  .getAllIndexedFS(cas.getTypeSystem().getTopType()).copy();
      
          // Option 2: explicitly moveToFirst 
          // fses.moveToFirst();
          
          int i = 0;
          while (fses.hasNext()) {
            fses.next();
            i++;
          }
          
          assertEquals(6, i);
        }
      

      Maybe you have some idea or can highlight another UIMA core test case where this could be conveniently tried out. (Unfortunately, setting up a test CAS in plain UIMA is a bit painful/verbose)

      Attachments

        Activity

          People

            schor Marshall Schor
            rec Richard Eckart de Castilho
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: