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

java.io.FilterReader considered harmful

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0-BETA
    • Fix Version/s: 4.0, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      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. NoRandomReadMockTokenizer.java
          2 kB
          Artem Lukanin
        2. LUCENE-4321.patch
          2 kB
          Robert Muir
        3. LUCENE-4321.patch
          4 kB
          Robert Muir
        4. LUCENE-4321.patch
          10 kB
          Robert Muir
        5. LUCENE-4321.patch
          14 kB
          Robert Muir
        6. LUCENE-4321.patch
          14 kB
          Robert Muir
        7. LUCENE-4321.patch
          14 kB
          Robert Muir

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: