[
https://issues.apache.org/jira/browse/LUCENE-3990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254569#comment-13254569
]
Uwe Schindler commented on LUCENE-3990:
---------------------------------------
I investigated why the original commit lead to the bug:
The current committed stuff (Robert's revert and also my latest patch), just
hide a bug in MappingCharFilter that causes this. Let me explain:
- With Robert's patch (and also my current fix): read(char[],int,int) and
read() both delegate to the underlying charstream.
- With the original CharFilter approach, int read() was not overridden, so the
default method in java.io.Reader did the following: allocate char[1], call
read(buffer,0,1) -> MappingCharFilters's buffered read method was called.
Unfortunately this method is behaving different than MappingCharFilter's
one-character read(). And thats the bug here. So neither my code nor Roberts
code is to blame, its MappingCharFilter or MockCharFilter that behave different
in the two read methods.
> TestRandomChains failure caused by incorrect delegation in
> CharReader/CharFilter/CharStream API
> -----------------------------------------------------------------------------------------------
>
> Key: LUCENE-3990
> URL: https://issues.apache.org/jira/browse/LUCENE-3990
> Project: Lucene - Java
> Issue Type: Bug
> Components: modules/analysis
> Reporter: Steven Rowe
> Assignee: Uwe Schindler
> Fix For: 4.0
>
> Attachments: LUCENE-3990-CharFilterFix.patch, LUCENE-3990.patch,
> analysis-common.tests-report.txt
>
>
> 100% reproduces for me:
> 2> NOTE: reproduce with: ant test -Dtests.class=*.TestRandomChains
> -Dtests.method=testRandomChains -Dtests.seed=88CA02C2BB7B1DA
> -Dargs="-Dfile.encoding=UTF-8"
> Running org.apache.lucene.analysis.core.TestRandomChains
> FAILURE 7.22s | TestRandomChains.testRandomChains
> > Throwable #1: java.lang.AssertionError: endOffset 1 expected:<7> but
> was:<8>
> > at
> __randomizedtesting.SeedInfo.seed([88CA02C2BB7B1DA:356D894D6CA5AC1A]:0)
> > at org.junit.Assert.fail(Assert.java:93)
> > at org.junit.Assert.failNotEquals(Assert.java:647)
> > at org.junit.Assert.assertEquals(Assert.java:128)
> > at org.junit.Assert.assertEquals(Assert.java:472)
> > at
> org.apache.lucene.analysis.BaseTokenStreamTestCase.assertTokenStreamContents(BaseTokenStreamTestCase.java:165)
> > at
> org.apache.lucene.analysis.BaseTokenStreamTestCase.checkAnalysisConsistency(BaseTokenStreamTestCase.java:662)
> > at
> org.apache.lucene.analysis.BaseTokenStreamTestCase.checkRandomData(BaseTokenStreamTestCase.java:486)
> > at
> org.apache.lucene.analysis.BaseTokenStreamTestCase.checkRandomData(BaseTokenStreamTestCase.java:429)
> > at
> org.apache.lucene.analysis.core.TestRandomChains.testRandomChains(TestRandomChains.java:820)
> The root cause of this is inconsequent override of several Reader methods in
> subclasses of CharFilter. We should fix this urgently, thanks to the random
> chains we found this bug.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]