respect closeable

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1593385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-05-08 19:14:32 +00:00
parent 31a05cebdd
commit b943e47c99
1 changed files with 3 additions and 1 deletions

View File

@ -346,7 +346,9 @@ public class RandomIndexWriter implements Closeable {
*/
@Override
public void close() throws IOException {
LuceneTestCase.maybeChangeLiveIndexWriterConfig(r, w.getConfig());
if (!w.isClosed()) {
LuceneTestCase.maybeChangeLiveIndexWriterConfig(r, w.getConfig());
}
// if someone isn't using getReader() API, we want to be sure to
// forceMerge since presumably they might open a reader on the dir.
if (getReaderCalled == false && r.nextInt(8) == 2) {