lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject MockIndexOutputWrapper and maybeThrowDeterministicException()
Date Wed, 25 May 2011 10:00:33 GMT
Hi

While working on LUCENE-3139, I found out that we have a good number of
tests that fail to release resources. I tracked one problem of the above
class not calling delegate.close() if an exception is thrown from
maybeThrow...(), and fixed it.

Other tests seem to suffer from the same illness, in other methods. For
example, TestIndexWriterExceptions.testDocumentsWriterAbort fails to delete
the director too, b/c MockIOWrapper.writeBytes() calls maybeThrow...() and
if indeed something is thrown, the file stays open.

You can simulate that on Windows if you run the test w/
-Dtests.directory=FSDirectory.

I think in order to solve that, we need to try-catch any calls to
maybeThrow. If an exception was indeed thrown, we close() and rethrow it?

Shai

Mime
View raw message