Skip to content

Apache Lucene open-source search software

Align batch exception handling with document method (#16270)

Tim Brooks4923c96dae6b
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index 79bada22d57..d2be47854e8 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -1541,21 +1541,17 @@ public class IndexWriter
final DocumentsWriterDeleteQueue.Node<?> delNode, ColumnBatch columnBatch)
throws IOException {
ensureOpen();
- boolean success = false;
try {
- final long seqNo = maybeProcessEvents(docWriter.updateBatch(columnBatch, delNode));
- success = true;
- return seqNo;
- } catch (Error tragedy) {
- tragicEvent(tragedy, "updateBatch");
- throw tragedy;
- } finally {
- if (success == false) {
- if (infoStream.isEnabled("IW")) {
- infoStream.message("IW", "hit exception adding batch");
- }
- maybeCloseOnTragicEvent();
+ return maybeProcessEvents(docWriter.updateBatch(columnBatch, delNode));
+ } catch (Throwable t) {
+ if (t instanceof Error) {
+ onTragicEvent(t, "updateBatch");
}
+ if (infoStream.isEnabled("IW")) {
+ infoStream.message("IW", "hit exception adding batch: " + t);
+ }
+ maybeCloseOnTragicEvent();
+ throw t;
}
}