You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by md...@apache.org on 2022/02/02 15:53:25 UTC
[lucene] branch branch_9x updated: null check on infoStream (#637)
This is an automated email from the ASF dual-hosted git repository.
mdrob pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 3c48bb6 null check on infoStream (#637)
3c48bb6 is described below
commit 3c48bb608aa9a6dec6cc7e1815aed47ad7674a70
Author: Mike Drob <md...@apache.org>
AuthorDate: Wed Feb 2 09:44:31 2022 -0600
null check on infoStream (#637)
(cherry picked from commit 56f49257ed64669a79786ff93595aa210a98e402)
---
lucene/core/src/java/org/apache/lucene/index/CheckIndex.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
index 3dd5526..57080ee 100644
--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
@@ -506,6 +506,12 @@ public final class CheckIndex implements Closeable {
setInfoStream(out, false);
}
+ private static void msg(PrintStream out, ByteArrayOutputStream msg) {
+ if (out != null) {
+ out.println(msg.toString(StandardCharsets.UTF_8));
+ }
+ }
+
private static void msg(PrintStream out, String msg) {
if (out != null) {
out.println(msg);
@@ -778,21 +784,21 @@ public final class CheckIndex implements Closeable {
} catch (InterruptedException e) {
// the segment test output should come before interrupted exception message that follows,
// hence it's not emitted from finally clause
- infoStream.println(output.toString(StandardCharsets.UTF_8));
+ msg(infoStream, output);
msg(
infoStream,
"ERROR: Interrupted exception occurred when getting segment check result for segment "
+ info.info.name);
if (infoStream != null) e.printStackTrace(infoStream);
} catch (ExecutionException e) {
- infoStream.println(output.toString(StandardCharsets.UTF_8));
+ msg(infoStream, output.toString(StandardCharsets.UTF_8));
assert failFast;
throw new CheckIndexException(
"Segment " + info.info.name + " check failed.", e.getCause());
}
- infoStream.print(output.toString(StandardCharsets.UTF_8));
+ msg(infoStream, output);
processSegmentInfoStatusResult(result, info, segmentInfoStatus);
}