mirror of https://github.com/apache/lucene.git
LUCENE-4996: Include field name in all DocInverter exceptions
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1481080 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
08a140dcf5
commit
afbca4dc8a
|
@ -126,6 +126,9 @@ Bug Fixes
|
||||||
|
|
||||||
* LUCENE-4993: Fix BeiderMorseFilter to preserve custom attributes when
|
* LUCENE-4993: Fix BeiderMorseFilter to preserve custom attributes when
|
||||||
inserting tokens with position increment 0. (Uwe Schindler)
|
inserting tokens with position increment 0. (Uwe Schindler)
|
||||||
|
|
||||||
|
* LUCENE-4996: Ensure DocInverterPerField always includes field name
|
||||||
|
in exception messages. (Markus Jelsma via Robert Muir)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
|
|
||||||
|
|
|
@ -119,10 +119,10 @@ final class DocInverterPerField extends DocFieldConsumerPerField {
|
||||||
|
|
||||||
final int posIncr = posIncrAttribute.getPositionIncrement();
|
final int posIncr = posIncrAttribute.getPositionIncrement();
|
||||||
if (posIncr < 0) {
|
if (posIncr < 0) {
|
||||||
throw new IllegalArgumentException("position increment must be >=0 (got " + posIncr + ")");
|
throw new IllegalArgumentException("position increment must be >=0 (got " + posIncr + ") for field '" + field.name() + "'");
|
||||||
}
|
}
|
||||||
if (fieldState.position == 0 && posIncr == 0) {
|
if (fieldState.position == 0 && posIncr == 0) {
|
||||||
throw new IllegalArgumentException("first position increment must be > 0 (got 0)");
|
throw new IllegalArgumentException("first position increment must be > 0 (got 0) for field '" + field.name() + "'");
|
||||||
}
|
}
|
||||||
int position = fieldState.position + posIncr;
|
int position = fieldState.position + posIncr;
|
||||||
if (position > 0) {
|
if (position > 0) {
|
||||||
|
@ -145,11 +145,11 @@ final class DocInverterPerField extends DocFieldConsumerPerField {
|
||||||
int endOffset = fieldState.offset + offsetAttribute.endOffset();
|
int endOffset = fieldState.offset + offsetAttribute.endOffset();
|
||||||
if (startOffset < 0 || endOffset < startOffset) {
|
if (startOffset < 0 || endOffset < startOffset) {
|
||||||
throw new IllegalArgumentException("startOffset must be non-negative, and endOffset must be >= startOffset, "
|
throw new IllegalArgumentException("startOffset must be non-negative, and endOffset must be >= startOffset, "
|
||||||
+ "startOffset=" + startOffset + ",endOffset=" + endOffset);
|
+ "startOffset=" + startOffset + ",endOffset=" + endOffset + " for field '" + field.name() + "'");
|
||||||
}
|
}
|
||||||
if (startOffset < lastStartOffset) {
|
if (startOffset < lastStartOffset) {
|
||||||
throw new IllegalArgumentException("offsets must not go backwards startOffset="
|
throw new IllegalArgumentException("offsets must not go backwards startOffset="
|
||||||
+ startOffset + " is < lastStartOffset=" + lastStartOffset);
|
+ startOffset + " is < lastStartOffset=" + lastStartOffset + " for field '" + field.name() + "'");
|
||||||
}
|
}
|
||||||
lastStartOffset = startOffset;
|
lastStartOffset = startOffset;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue