From c36495dce759adbd3c65d047a778f76db4c34c43 Mon Sep 17 00:00:00 2001 From: Mike Drob Date: Fri, 20 Aug 2021 15:40:52 -0500 Subject: [PATCH] LUCENE-10017 Less verbose exception on IndexFormatTooOld (#200) --- .../org/apache/lucene/codecs/CodecUtil.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java b/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java index a0a3f906260..921ffdb16b1 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java @@ -490,12 +490,17 @@ public final class CodecUtil { // now check the footer long checksum = checkFooter(in); - priorException.addSuppressed( - new CorruptIndexException( - "checksum passed (" - + Long.toHexString(checksum) - + "). possibly transient resource issue, or a Lucene or JVM bug", - in)); + if (!(priorException instanceof IndexFormatTooOldException)) { + // If the index format is too old and no corruption, do not add checksums + // matching message since this may tend to unnecessarily alarm people who + // see "JVM bug" in their logs + priorException.addSuppressed( + new CorruptIndexException( + "checksum passed (" + + Long.toHexString(checksum) + + "). possibly transient resource issue, or a Lucene or JVM bug", + in)); + } } } catch (CorruptIndexException corruptException) { corruptException.addSuppressed(priorException);