LUCENE-951: Fixed NullPointerException in MultiLevelSkipListReader that was thrown after a call of TermPositions.seek().

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@555683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Busch 2007-07-12 16:23:46 +00:00
parent c8f84d6707
commit 7c612dcb2d
3 changed files with 19 additions and 10 deletions

View File

@ -24,6 +24,10 @@ Bug fixes
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
1. LUCENE-906: Elision filter for French.

View File

@ -172,9 +172,11 @@ abstract class MultiLevelSkipListReader {
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;
}
}

View File

@ -57,10 +57,12 @@ public class TestMultiLevelSkipList extends TestCase {
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();
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
@ -70,6 +72,7 @@ public class TestMultiLevelSkipList extends TestCase {
// 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 {
tp.skipTo(target);