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

This commit is contained in:
Mike Drob 2021-08-20 15:40:52 -05:00 committed by GitHub
parent 0c3c8ec09a
commit c36495dce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -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);