Re: Closing directory in LuceneTestCase causes stacktrace

2012-06-28 Thread Brendan Grainger
Oops, I finally see it sorry. I could have sworn that this: writer.close(); searcher.close(); directory.close(); was this! writer.close(); searcher.close(); reader.close(); directory.c

Re: Closing directory in LuceneTestCase causes stacktrace

2012-06-28 Thread Robert Muir
That doesnt fix it, that hides your bug. Please re-read what I wrote. If your application code looks like this test then you are leaking file handles. close your indexreader! On Thu, Jun 28, 2012 at 10:39 PM, Brendan Grainger wrote: > Hi Robert, > > Looks like this fixes it: > >                

Re: Closing directory in LuceneTestCase causes stacktrace

2012-06-28 Thread Brendan Grainger
Hi Robert, Looks like this fixes it: MockDirectoryWrapper directory = newDirectory(); directory.setNoDeleteOpenFile(false); // Don't emulate windows Thanks Brendan Grainger brendan.grain...@gmail.com www.kuripai.com On Jun 28, 2012, at 8:57 PM, Robert Muir wrote

Re: Closing directory in LuceneTestCase causes stacktrace

2012-06-28 Thread Brendan Grainger
Hi Robert, I am trying to close the Directory on the very last line of the method which is where the exception is being thrown: assertEquals("cool cat", doc.get("contents")); writer.close(); searcher.close(); direct

Re: Closing directory in LuceneTestCase causes stacktrace

2012-06-28 Thread Robert Muir
On Thu, Jun 28, 2012 at 8:22 PM, Brendan Grainger wrote: > > Interestingly, if I change the *** line above to use the deprecated > constructor taking just the directory it works fine: > its not interesting at all, its the typical contract of a java method. he who opens it closes it. I'll quote

Re: Closing directory in LuceneTestCase causes stacktrace

2012-06-28 Thread Brendan Grainger
I am closing the directory and that's the line where the exception about the open files is being thrown: public class MetaphoneReplacementAnaylyzerTest extends LuceneTestCase { @Test public void testKoolKat() throws Exception { Analyzer an

Closing directory in LuceneTestCase causes stacktrace

2012-06-28 Thread Brendan Grainger
Hi, I'm trying to brush up on some of the *cough* newer APIs (we've been using 2.9.2 up until now). Anyway, I have the test below which a modified version of one of the tests in Lucene In Action, but uses LuceneTestCase as a base class. public class MetaphoneReplacementAnaylyzerTest extends Lu