From d9973a38db906a1bf2d8f2122163e3a4cef1c17c Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Mon, 10 Apr 2017 19:07:25 -0400 Subject: [PATCH] LUCENE-7775: fix exception handling to throw first exception hit --- .../src/java/org/apache/lucene/index/BufferedUpdatesStream.java | 2 +- .../core/src/java/org/apache/lucene/index/SegmentDocValues.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java b/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java index 9da1e09530d..e5aae4f0929 100644 --- a/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java +++ b/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java @@ -456,7 +456,7 @@ class BufferedUpdatesStream implements Accountable { try { segStates[j].finish(pool); } catch (Throwable th) { - if (firstExc != null) { + if (firstExc == null) { firstExc = th; } } diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java b/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java index ce2050f76de..4838799097a 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java @@ -85,7 +85,7 @@ final class SegmentDocValues { try { dvp.decRef(); } catch (Throwable th) { - if (t != null) { + if (t == null) { t = th; } }