Apache Solr open-source search software
LUCENE-9416: fix CheckIndex to print an invalid non-zero norm as unsigned long when detecting corruption
Mike McCandless327d860a00cb
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex fc1fbbcf798..f4b8d287b1c 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -175,6 +175,9 @@ Improvementsper hit in dependencies, ExpressionFunctionValues will no longerrecompute already computed values (Haoyu Zhai)+* LUCENE-9416: Fix CheckIndex to print an invalid non-zero norm as+ unsigned long when detecting corruption.+Optimizations---------------------(No changes)diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.javaindex 79d68856f87..3b1f533bc47 100644--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java@@ -1671,7 +1671,7 @@ public final class CheckIndex implements Closeable {}final long norm = norms.longValue();if (norm != 0 && visitedDocs.get(doc) == false) {- throw new RuntimeException("Document " + doc + " doesn't have terms according to postings but has a norm value that is not zero: " + norm);+ throw new RuntimeException("Document " + doc + " doesn't have terms according to postings but has a norm value that is not zero: " + Long.toUnsignedString(norm));} else if (norm == 0 && visitedDocs.get(doc)) {throw new RuntimeException("Document " + doc + " has terms according to postings but its norm value is 0, which may only be used on documents that have no terms");}