mirror of https://github.com/apache/lucene.git
LUCENE-4948: Fix stinkbug in PostingsHighlighter (wrong array sizing on some jvms)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1470642 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
13be62c316
commit
c5a5a77336
|
@ -42,6 +42,10 @@ Bug Fixes
|
||||||
* LUCENE-4935: CustomScoreQuery wrongly applied its query boost twice
|
* LUCENE-4935: CustomScoreQuery wrongly applied its query boost twice
|
||||||
(boost^2). (Robert Muir)
|
(boost^2). (Robert Muir)
|
||||||
|
|
||||||
|
* LUCENE-4948: Fixed ArrayIndexOutOfBoundsException in PostingsHighlighter
|
||||||
|
if you had a 64-bit JVM without compressed OOPS: IBM J9, or Oracle with
|
||||||
|
large heap/explicitly disabled. (Mike McCandless, Uwe Schindler, Robert Muir)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
|
|
||||||
* LUCENE-4938: Don't use an unnecessarily large priority queue in IndexSearcher
|
* LUCENE-4938: Don't use an unnecessarily large priority queue in IndexSearcher
|
||||||
|
|
|
@ -42,12 +42,18 @@ public final class Passage {
|
||||||
void addMatch(int startOffset, int endOffset, BytesRef term) {
|
void addMatch(int startOffset, int endOffset, BytesRef term) {
|
||||||
assert startOffset >= this.startOffset && startOffset <= this.endOffset;
|
assert startOffset >= this.startOffset && startOffset <= this.endOffset;
|
||||||
if (numMatches == matchStarts.length) {
|
if (numMatches == matchStarts.length) {
|
||||||
matchStarts = ArrayUtil.grow(matchStarts, numMatches+1);
|
int newLength = ArrayUtil.oversize(numMatches+1, RamUsageEstimator.NUM_BYTES_OBJECT_REF);
|
||||||
matchEnds = ArrayUtil.grow(matchEnds, numMatches+1);
|
int newMatchStarts[] = new int[newLength];
|
||||||
BytesRef newMatchTerms[] = new BytesRef[ArrayUtil.oversize(numMatches+1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
|
int newMatchEnds[] = new int[newLength];
|
||||||
|
BytesRef newMatchTerms[] = new BytesRef[newLength];
|
||||||
|
System.arraycopy(matchStarts, 0, newMatchStarts, 0, numMatches);
|
||||||
|
System.arraycopy(matchEnds, 0, newMatchEnds, 0, numMatches);
|
||||||
System.arraycopy(matchTerms, 0, newMatchTerms, 0, numMatches);
|
System.arraycopy(matchTerms, 0, newMatchTerms, 0, numMatches);
|
||||||
|
matchStarts = newMatchStarts;
|
||||||
|
matchEnds = newMatchEnds;
|
||||||
matchTerms = newMatchTerms;
|
matchTerms = newMatchTerms;
|
||||||
}
|
}
|
||||||
|
assert matchStarts.length == matchEnds.length && matchEnds.length == matchTerms.length;
|
||||||
matchStarts[numMatches] = startOffset;
|
matchStarts[numMatches] = startOffset;
|
||||||
matchEnds[numMatches] = endOffset;
|
matchEnds[numMatches] = endOffset;
|
||||||
matchTerms[numMatches] = term;
|
matchTerms[numMatches] = term;
|
||||||
|
|
Loading…
Reference in New Issue