Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-4321

java.io.FilterReader considered harmful

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0-BETA
    • 4.0, 6.0
    • None
    • None
    • New

    Description

      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.

      Attachments

        1. LUCENE-4321.patch
          14 kB
          Robert Muir
        2. LUCENE-4321.patch
          14 kB
          Robert Muir
        3. LUCENE-4321.patch
          14 kB
          Robert Muir
        4. LUCENE-4321.patch
          10 kB
          Robert Muir
        5. LUCENE-4321.patch
          4 kB
          Robert Muir
        6. LUCENE-4321.patch
          2 kB
          Robert Muir
        7. NoRandomReadMockTokenizer.java
          2 kB
          Artem Lukanin

        Activity

          People

            Unassigned Unassigned
            rcmuir Robert Muir
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: