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

Robert Muir updated LUCENE-6124:
--------------------------------
    Attachment: LUCENE-6124_asserts.patch

I added tests to BaseDirectoryTestCase.

Some .store code has bugs too, e.g.:
{noformat}
org.apache.lucene.store.AlreadyClosedException: this Directory is closed
    at org.apache.lucene.store.BaseDirectory.ensureOpen(BaseDirectory.java:50)
    at org.apache.lucene.store.RAMDirectory.listAll(RAMDirectory.java:106)
    at 
org.apache.lucene.store.NRTCachingDirectory.close(NRTCachingDirectory.java:203)
    at 
org.apache.lucene.store.BaseDirectoryTestCase.testDoubleCloseDirectory(BaseDirectoryTestCase.java:1050)
{noformat}

> Fix broken close() methods
> --------------------------
>
>                 Key: LUCENE-6124
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6124
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-6124_asserts.patch, LUCENE-6124_asserts.patch
>
>
> 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:
> {noformat}
>    [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
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to