lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-3042) AttributeSource can have an invalid computed state
Date Fri, 22 Apr 2011 19:32:05 GMT

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

Robert Muir commented on LUCENE-3042:
-------------------------------------

Trivial test: if you add computeCurrentState() unconditionally as the first line of AttributeSource.clearAttributes,
the test will pass.

{noformat}
public class SimpleTest extends BaseTokenStreamTestCase {
  public void testSimple() throws IOException {
    String testString = "t";
    
    Analyzer analyzer = new MockAnalyzer(random);
    TokenStream stream = analyzer.reusableTokenStream("dummy", new StringReader(testString));
    stream.reset();
    while (stream.incrementToken()) {
      // consume
    }
    
    assertAnalyzesToReuse(analyzer, testString, new String[] { "t" });
  }
}
{noformat}

> AttributeSource can have an invalid computed state
> --------------------------------------------------
>
>                 Key: LUCENE-3042
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3042
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>
> If you work a tokenstream, consume it, then reuse it and add an attribute to it, the
computed state is wrong.
> thus for example, clearAttributes() will not actually clear the attribute added.
> So in some situations, addAttribute is not actually clearing the computed state when
it should.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message