You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Artem Lukanin (JIRA)" <ji...@apache.org> on 2013/01/14 13:30:12 UTC

[jira] [Updated] (LUCENE-4321) java.io.FilterReader considered harmful

     [ https://issues.apache.org/jira/browse/LUCENE-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Artem Lukanin updated LUCENE-4321:
----------------------------------

    Attachment: NoRandomReadMockTokenizer.java

I had to extend MockTokenizer, because I read the buffer completely to decide, what to do with the input (convert or not to something else).

When you use different reading methods randomly, my tests don't pass. If you used the same method (may be different) for the complete input string, they would pass, but now the output string is messed up, becase some parts of the input are converted and some are not.
                
> java.io.FilterReader considered harmful
> ---------------------------------------
>
>                 Key: LUCENE-4321
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4321
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 4.0-BETA
>            Reporter: Robert Muir
>             Fix For: 4.0, 5.0
>
>         Attachments: LUCENE-4321.patch, LUCENE-4321.patch, LUCENE-4321.patch, LUCENE-4321.patch, LUCENE-4321.patch, LUCENE-4321.patch, NoRandomReadMockTokenizer.java
>
>
> See Dawid's email: http://find.searchhub.org/document/64b0a28c53faf39
> Reader.java is fine, it has lots of methods like read(), read(char[]), read(CharBuffer), skip(), but these all have default implementations delegating to read(char[], int, int).
> Unfortunately FilterReader delegates too many unnecessary things such as read() and skip() in a broken way. It should have just left these alone.
> This can cause traps for someone upgrading because they have to override multiple methods, when read(char[], int, int) should be enough, and all Reader methods will then work correctly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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