Skip to content

Apache Lucene open-source search software

LUCENE-10017 Less verbose exception on IndexFormatTooOld (#200)

Mike Drobc36495dce759
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);