lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r907781 - in /lucene/java/trunk/src/java/org/apache/lucene: index/SegmentInfo.java index/SegmentReader.java util/BitVector.java
Date Mon, 08 Feb 2010 20:31:26 GMT
Author: mikemccand
Date: Mon Feb  8 20:31:25 2010
New Revision: 907781

URL: http://svn.apache.org/viewvc?rev=907781&view=rev
Log:
add assert to catch mismatched delete count on write; add detail to exception messages on
corruption

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java?rev=907781&r1=907780&r2=907781&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java Mon Feb  8 20:31:25
2010
@@ -533,6 +533,7 @@
    */
   void write(IndexOutput output)
     throws IOException {
+    assert delCount <= docCount: "delCount=" + delCount + " docCount=" + docCount + "
segment=" + name;
     output.writeString(name);
     output.writeInt(docCount);
     output.writeLong(delGen);

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java?rev=907781&r1=907780&r2=907781&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java Mon Feb  8 20:31:25
2010
@@ -613,7 +613,7 @@
       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;

Modified: lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java?rev=907781&r1=907780&r2=907781&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java Mon Feb  8 20:31:25 2010
@@ -63,7 +63,7 @@
   /** 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 @@
    *  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];



Mime
View raw message