mirror of https://github.com/apache/lucene.git
LUCENE-7467: improve exception message when token position overflows int
This commit is contained in:
parent
ba482681f3
commit
6f6f73e0c7
|
@ -723,8 +723,10 @@ final class DefaultIndexingChain extends DocConsumer {
|
||||||
if (invertState.position < invertState.lastPosition) {
|
if (invertState.position < invertState.lastPosition) {
|
||||||
if (posIncr == 0) {
|
if (posIncr == 0) {
|
||||||
throw new IllegalArgumentException("first position increment must be > 0 (got 0) for field '" + field.name() + "'");
|
throw new IllegalArgumentException("first position increment must be > 0 (got 0) for field '" + field.name() + "'");
|
||||||
|
} else if (posIncr < 0) {
|
||||||
|
throw new IllegalArgumentException("position increment must be >= 0 (got " + posIncr + ") for field '" + field.name() + "'");
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("position increments (and gaps) must be >= 0 (got " + posIncr + ") for field '" + field.name() + "'");
|
throw new IllegalArgumentException("position overflowed Integer.MAX_VALUE (got posIncr=" + posIncr + " lastPosition=" + invertState.lastPosition + " position=" + invertState.position + ") for field '" + field.name() + "'");
|
||||||
}
|
}
|
||||||
} else if (invertState.position > IndexWriter.MAX_POSITION) {
|
} else if (invertState.position > IndexWriter.MAX_POSITION) {
|
||||||
throw new IllegalArgumentException("position " + invertState.position + " is too large for field '" + field.name() + "': max allowed position is " + IndexWriter.MAX_POSITION);
|
throw new IllegalArgumentException("position " + invertState.position + " is too large for field '" + field.name() + "': max allowed position is " + IndexWriter.MAX_POSITION);
|
||||||
|
|
Loading…
Reference in New Issue