lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r555683 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/MultiLevelSkipListReader.java src/test/org/apache/lucene/index/TestMultiLevelSkipList.java
Date Thu, 12 Jul 2007 16:23:47 GMT
Author: buschmi
Date: Thu Jul 12 09:23:46 2007
New Revision: 555683

URL: http://svn.apache.org/viewvc?view=rev&rev=555683
Log:
LUCENE-951: Fixed NullPointerException in MultiLevelSkipListReader that was thrown after a
call of TermPositions.seek(). 

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/index/MultiLevelSkipListReader.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=555683&r1=555682&r2=555683
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Thu Jul 12 09:23:46 2007
@@ -23,6 +23,10 @@
 
  2. LUCENE-955: Fixed SegmentTermPositions to work correctly with the
     first term in the dictionary. (Michael Busch)
+
+ 3. LUCENE-951: Fixed NullPointerException in MultiLevelSkipListReader
+    that was thrown after a call of TermPositions.seek(). 
+    (Rich Johnson via Michael Busch)
     
 New features
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/MultiLevelSkipListReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/MultiLevelSkipListReader.java?view=diff&rev=555683&r1=555682&r2=555683
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/MultiLevelSkipListReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/MultiLevelSkipListReader.java Thu Jul
12 09:23:46 2007
@@ -172,9 +172,11 @@
     this.docCount = df;
     Arrays.fill(skipDoc, 0);
     Arrays.fill(numSkipped, 0);
+    Arrays.fill(childPointer, 0);
+    
     haveSkipped = false;
     for (int i = 1; i < numberOfSkipLevels; i++) {
-      skipStream[0] = null;
+      skipStream[i] = null;
     }
   }
   

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java?view=diff&rev=555683&r1=555682&r2=555683
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java Thu Jul
12 09:23:46 2007
@@ -57,18 +57,21 @@
     writer.close();
 
     IndexReader reader = IndexReader.open(dir);
-    SegmentTermPositions tp = (SegmentTermPositions) reader.termPositions(term);
+    SegmentTermPositions tp = (SegmentTermPositions) reader.termPositions();
     tp.freqStream = new CountingStream(tp.freqStream);
-    
-    tp.next();
 
-    checkSkipTo(tp, 14, 185); // no skips
-    checkSkipTo(tp, 17, 190); // one skip on level 0
-    checkSkipTo(tp, 287, 200); // one skip on level 1, two on level 0
+    for (int i = 0; i < 2; i++) {
+      counter = 0;
+      tp.seek(term);
+
+      checkSkipTo(tp, 14, 185); // no skips
+      checkSkipTo(tp, 17, 190); // one skip on level 0
+      checkSkipTo(tp, 287, 200); // one skip on level 1, two on level 0
     
-    // this test would fail if we had only one skip level,
-    // because than more bytes would be read from the freqStream
-    checkSkipTo(tp, 4800, 250);// one skip on level 2
+      // this test would fail if we had only one skip level,
+      // because than more bytes would be read from the freqStream
+      checkSkipTo(tp, 4800, 250);// one skip on level 2
+    }
   }
 
   public void checkSkipTo(TermPositions tp, int target, int maxCounter) throws IOException
{



Mime
View raw message