diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.java index 96d87cbe85d..9e5cb814db1 100644 --- a/src/java/org/apache/lucene/index/IndexWriter.java +++ b/src/java/org/apache/lucene/index/IndexWriter.java @@ -2540,9 +2540,9 @@ public class IndexWriter { else { Iterator it = pendingMerges.iterator(); while(it.hasNext()) { - // Advance the merge from pending to running MergePolicy.OneMerge merge = (MergePolicy.OneMerge) it.next(); if (merge.isExternal) { + // Advance the merge from pending to running it.remove(); runningMerges.add(merge); return merge;