You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2011/04/15 10:31:17 UTC

svn commit: r1092627 - /lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java

Author: simonw
Date: Fri Apr 15 08:31:17 2011
New Revision: 1092627

URL: http://svn.apache.org/viewvc?rev=1092627&view=rev
Log:
LUCENE-3032: TestIndexWriterException fails with NPE on realtime

Modified:
    lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java

Modified: lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java?rev=1092627&r1=1092626&r2=1092627&view=diff
==============================================================================
--- lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java (original)
+++ lucene/dev/branches/realtime_search/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java Fri Apr 15 08:31:17 2011
@@ -325,9 +325,13 @@ public class DocumentsWriterPerThread {
   FrozenBufferedDeletes prepareFlush() {
     assert numDocsInRAM > 0;
     final FrozenBufferedDeletes globalDeletes = deleteQueue.freezeGlobalBuffer(deleteSlice);
-    // apply all deletes before we flush and release the delete slice
-    deleteSlice.apply(pendingDeletes, numDocsInRAM);
-    deleteSlice = null;
+    /* 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
+      deleteSlice.apply(pendingDeletes, numDocsInRAM);
+      deleteSlice = null;
+    }
     return globalDeletes;
   }