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

Robert Muir updated LUCENE-2598:
--------------------------------

    Attachment: LUCENE-2598.patch

heres the patch improved: the i/o wrappers remove themselves from the map, and 
the exception message is nicer. so if you forget to close files, you get:
{noformat}
junit-sequential:
    [junit] Testsuite: org.apache.lucene.TestDemo
    [junit] Testcase: testDemo(org.apache.lucene.TestDemo):     Caused an ERROR
    [junit] MockRAMDirectory: cannot close: there are still open files: 
{_0.cfs=1}
    [junit] java.lang.RuntimeException: MockRAMDirectory: cannot close: there 
are still open files: {_0.cfs=1}
    [junit]     at 
org.apache.lucene.store.MockDirectoryWrapper.close(MockDirectoryWrapper.java:342)
    [junit]     at org.apache.lucene.TestDemo.testDemo(TestDemo.java:81)
    [junit]     at 
org.apache.lucene.util.LuceneTestCase.runBare(LuceneTestCase.java:380)
    [junit]     at 
org.apache.lucene.util.LuceneTestCase.run(LuceneTestCase.java:372)
    [junit] Caused by: java.lang.RuntimeException: unclosed IndexInput
    [junit]     at 
org.apache.lucene.store.MockDirectoryWrapper.openInput(MockDirectoryWrapper.java:299)
    [junit]     at 
org.apache.lucene.store.Directory.openInput(Directory.java:138)
    [junit]     at 
org.apache.lucene.index.CompoundFileReader.<init>(CompoundFileReader.java:67)
    [junit]     at 
org.apache.lucene.index.SegmentReader$CoreReaders.<init>(SegmentReader.java:126)
    [junit]     at 
org.apache.lucene.index.SegmentReader.get(SegmentReader.java:536)
    [junit]     at 
org.apache.lucene.index.SegmentReader.get(SegmentReader.java:509)
    [junit]     at 
org.apache.lucene.index.DirectoryReader.<init>(DirectoryReader.java:129)
    [junit]     at 
org.apache.lucene.index.DirectoryReader$1.doBody(DirectoryReader.java:96)
    [junit]     at 
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:630)
    [junit]     at 
org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:91)
    [junit]     at 
org.apache.lucene.index.IndexReader.open(IndexReader.java:415)
    [junit]     at 
org.apache.lucene.index.IndexReader.open(IndexReader.java:234)
    [junit]     at 
org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:78)
    [junit]     at org.apache.lucene.TestDemo.testDemo(TestDemo.java:67)
{noformat}

> allow tests to use different Directory impls
> --------------------------------------------
>
>                 Key: LUCENE-2598
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2598
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Build
>    Affects Versions: 3.1, 4.0
>            Reporter: Robert Muir
>            Assignee: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2598.patch, LUCENE-2598.patch, LUCENE-2598.patch, 
> LUCENE-2598.patch, LUCENE-2598.patch, LUCENE-2598.patch, LUCENE-2598.patch
>
>
> Now that all tests use MockRAMDirectory instead of RAMDirectory, they are all 
> picky like windows and force our tests to
> close readers etc before closing the directory.
> I think we should do the following:
> # change new MockRAMDIrectory() in tests to .newDirectory(random)
> # LuceneTestCase[J4] tracks if all dirs are closed at tearDown and also 
> cleans up temp dirs like solr.
> # factor out the Mockish stuff from MockRAMDirectory into MockDirectoryWrapper
> # allow a -Dtests.directoryImpl or simpler to specify the default Directory 
> to use for tests: default being "random"
> i think theres a chance we might find some bugs that havent yet surfaced 
> because they are easier to trigger with FSDir
> Furthermore, this would be beneficial to Directory-implementors as they could 
> run the entire testsuite against their Directory impl, just like 
> codec-implementors can do now.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to