diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java b/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java index 5844836338f..c2ac1ce4c93 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java @@ -174,6 +174,7 @@ final class SegmentMerger { } } } + success = true; } finally { if (success) { IOUtils.close(consumer); @@ -202,6 +203,7 @@ final class SegmentMerger { consumer.mergeNumericField(field, mergeState, toMerge); } } + success = true; } finally { if (success) { IOUtils.close(consumer);