mirror of https://github.com/apache/lucene.git
add assert to catch mismatched delete count on write; add detail to exception messages on corruption
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@907781 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b4ac5029e0
commit
0a07c2a1fd
|
@ -533,6 +533,7 @@ public final class SegmentInfo {
|
|||
*/
|
||||
void write(IndexOutput output)
|
||||
throws IOException {
|
||||
assert delCount <= docCount: "delCount=" + delCount + " docCount=" + docCount + " segment=" + name;
|
||||
output.writeString(name);
|
||||
output.writeInt(docCount);
|
||||
output.writeLong(delGen);
|
||||
|
|
|
@ -613,7 +613,7 @@ public class SegmentReader extends IndexReader implements Cloneable {
|
|||
deletedDocsRef = new AtomicInteger(1);
|
||||
assert checkDeletedCounts();
|
||||
if (deletedDocs.size() != si.docCount) {
|
||||
throw new CorruptIndexException("document count mismatch: deleted docs count " + deletedDocs.size() + " vs segment doc count " + si.docCount);
|
||||
throw new CorruptIndexException("document count mismatch: deleted docs count " + deletedDocs.size() + " vs segment doc count " + si.docCount + " segment=" + si.name);
|
||||
}
|
||||
} else
|
||||
assert si.getDelCount() == 0;
|
||||
|
|
|
@ -63,7 +63,7 @@ public final class BitVector implements Cloneable {
|
|||
/** Sets the value of <code>bit</code> to one. */
|
||||
public final void set(int bit) {
|
||||
if (bit >= size) {
|
||||
throw new ArrayIndexOutOfBoundsException(bit);
|
||||
throw new ArrayIndexOutOfBoundsException("bit=" + bit + " size=" + size);
|
||||
}
|
||||
bits[bit >> 3] |= 1 << (bit & 7);
|
||||
count = -1;
|
||||
|
@ -73,7 +73,7 @@ public final class BitVector implements Cloneable {
|
|||
* returns true if bit was already set */
|
||||
public final boolean getAndSet(int bit) {
|
||||
if (bit >= size) {
|
||||
throw new ArrayIndexOutOfBoundsException(bit);
|
||||
throw new ArrayIndexOutOfBoundsException("bit=" + bit + " size=" + size);
|
||||
}
|
||||
final int pos = bit >> 3;
|
||||
final int v = bits[pos];
|
||||
|
|
Loading…
Reference in New Issue