lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: Closing directory in LuceneTestCase causes stacktrace
Date Thu, 28 Jun 2012 23:36:56 GMT
Hello,

this part of the stacktrace:


> Caused by: java.lang.RuntimeException: unclosed IndexInput: _0.prx
>        at org.apache.lucene.store.MockDirectoryWrapper.addFileHandle(MockDirectoryWrapper.java:472)
>        at org.apache.lucene.store.MockDirectoryWrapper.openInput(MockDirectoryWrapper.java:497)
>        at org.apache.lucene.store.Directory.openInput(Directory.java:145)
>        at org.apache.lucene.index.SegmentCoreReaders.<init>(SegmentCoreReaders.java:96)
>        at org.apache.lucene.index.SegmentReader.get(SegmentReader.java:116)
>        at org.apache.lucene.index.SegmentReader.get(SegmentReader.java:94)
>        at org.apache.lucene.index.DirectoryReader.<init>(DirectoryReader.java:105)
>        at org.apache.lucene.index.ReadOnlyDirectoryReader.<init>(ReadOnlyDirectoryReader.java:27)
>        at org.apache.lucene.index.DirectoryReader$1.doBody(DirectoryReader.java:78)
>        at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:709)
>        at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:72)
>        at org.apache.lucene.index.IndexReader.open(IndexReader.java:256)
>        at com.kuripai.lucene.analysis.MetaphoneReplacementAnaylyzerTest.testKoolKat(MetaphoneReplacementAnaylyzerTest.java:36)
>        ... 39 more
>

is telling you where in your code you opened the un-closed object that
you need to close.

looks to me like the problem is how you open your reader:
new IndexSearcher(IndexReader.open(directory));

in this case (where IndexSearcher takes a reader that you passed in),
closing the searcher won't actually close the underlying reader.
you passed it in, so you should be sure to close this reader yourself.

-- 
lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message