Skip to content

Apache Lucene open-source search software

throw ACE not NPE

Michael McCandlessb129fe961b83
diff --git a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThreadPool.java b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThreadPool.java
index b8805f79663..cb667c72f4f 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThreadPool.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThreadPool.java
@@ -18,6 +18,7 @@ package org.apache.lucene.index;
import java.util.concurrent.locks.ReentrantLock;
+import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.util.ThreadInterruptedException;
/**
@@ -190,7 +191,7 @@ final class DocumentsWriterPerThreadPool {
}
// we are closed: unlock since the threadstate is not active anymore
assert assertUnreleasedThreadStatesInactive();
- return null;
+ throw new AlreadyClosedException("this IndexWriter is closed");
} finally {
if (unlock) {
// in any case make sure we unlock if we fail