LUCENE-3032: TestIndexWriterException fails with NPE on realtime

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/realtime_search@1092627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-04-15 08:31:17 +00:00
parent 95b0aa44da
commit f90bf1aee8
1 changed files with 7 additions and 3 deletions

View File

@ -325,9 +325,13 @@ public class DocumentsWriterPerThread {
FrozenBufferedDeletes prepareFlush() { FrozenBufferedDeletes prepareFlush() {
assert numDocsInRAM > 0; assert numDocsInRAM > 0;
final FrozenBufferedDeletes globalDeletes = deleteQueue.freezeGlobalBuffer(deleteSlice); final FrozenBufferedDeletes globalDeletes = deleteQueue.freezeGlobalBuffer(deleteSlice);
/* deleteSlice can possibly be null if we have hit non-aborting exceptions during indexing and never succeeded
adding a document. */
if (deleteSlice != null) {
// apply all deletes before we flush and release the delete slice // apply all deletes before we flush and release the delete slice
deleteSlice.apply(pendingDeletes, numDocsInRAM); deleteSlice.apply(pendingDeletes, numDocsInRAM);
deleteSlice = null; deleteSlice = null;
}
return globalDeletes; return globalDeletes;
} }