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

Fix broken close() methods

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0, 6.0
    • None
    • None
    • New

    Description

      Closeable.close() says "If the stream is already closed then invoking this method has no effect.".

      But a lot of our code does not really respect that. If i add an "extra" close() call in assertingcodec, it finds all kinds of bugs in codec code, for example:

         [junit4] Tests with failures (first 10 out of 59):
         [junit4]   - org.apache.lucene.index.TestCrashCausesCorruptIndex.testCrashCorruptsIndexing
         [junit4]   - org.apache.lucene.codecs.asserting.TestAssertingPostingsFormat.testDocsOnly
         [junit4]   - org.apache.lucene.codecs.asserting.TestAssertingPostingsFormat.testDocsAndFreqsAndPositionsAndOffsetsAndPayloads
         [junit4]   - org.apache.lucene.codecs.asserting.TestAssertingPostingsFormat.testDocsAndFreqs
         [junit4]   - org.apache.lucene.codecs.asserting.TestAssertingPostingsFormat.testDocsAndFreqsAndPositionsAndOffsets
         [junit4]   - org.apache.lucene.codecs.asserting.TestAssertingPostingsFormat.testRandom
         [junit4]   - org.apache.lucene.codecs.asserting.TestAssertingPostingsFormat.testDocsAndFreqsAndPositionsAndPayloads
         [junit4]   - org.apache.lucene.codecs.asserting.TestAssertingPostingsFormat.testDocsAndFreqsAndPositions
         [junit4]   - org.apache.lucene.index.TestDirectoryReader.testFilesOpenClose
         [junit4]   - org.apache.lucene.index.TestIndexWriterDelete.testIndexingThenDeleting
      

      Attachments

        1. LUCENE-6124_asserts.patch
          5 kB
          Robert Muir
        2. LUCENE-6124_asserts.patch
          3 kB
          Robert Muir
        3. LUCENE-6124.patch
          33 kB
          Robert Muir
        4. LUCENE-6124.patch
          23 kB
          Robert Muir
        5. LUCENE-6124.patch
          22 kB
          Robert Muir

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: