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 2015/06/26 23:09:05 UTC

[jira] [Created] (UIMA-4487) Position lost on FSIterator copy

Richard Eckart de Castilho created UIMA-4487:
------------------------------------------------

             Summary: Position lost on FSIterator copy
                 Key: UIMA-4487
                 URL: https://issues.apache.org/jira/browse/UIMA-4487
             Project: UIMA
          Issue Type: Bug
          Components: Core Java Framework
            Reporter: Richard Eckart de Castilho
             Fix For: 2.8.0SDK


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:

{noformat}
  @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);
  }
{noformat}

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)



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

Re: [jira] [Created] (UIMA-4487) Position lost on FSIterator copy

Posted by Marshall Schor <ms...@schor.com>.
I'll take a look over the weekend...  -Marshall

On 6/26/2015 5:09 PM, Richard Eckart de Castilho (JIRA) wrote:
> Richard Eckart de Castilho created UIMA-4487:
> ------------------------------------------------
>
>              Summary: Position lost on FSIterator copy
>                  Key: UIMA-4487
>                  URL: https://issues.apache.org/jira/browse/UIMA-4487
>              Project: UIMA
>           Issue Type: Bug
>           Components: Core Java Framework
>             Reporter: Richard Eckart de Castilho
>              Fix For: 2.8.0SDK
>
>
> 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:
>
> {noformat}
>   @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);
>   }
> {noformat}
>
> 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)
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)
>