mirror of https://github.com/apache/lucene.git
LUCENE-3969: check that startOffset <= endOffset; comment out sops
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3969@1311406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3e098abaed
commit
9e98ec186c
|
@ -82,19 +82,23 @@ public final class ValidatingTokenFilter extends TokenFilter {
|
|||
final int startOffset = offsetAtt.startOffset();
|
||||
final int endOffset = offsetAtt.endOffset();
|
||||
|
||||
if (endOffset < startOffset) {
|
||||
throw new IllegalStateException(name + ": startOffset=" + startOffset + " is > endOffset=" + endOffset + " pos=" + pos + "; token=" + termAtt);
|
||||
}
|
||||
|
||||
final int posLen = posLenAtt == null ? 1 : posLenAtt.getPositionLength();
|
||||
|
||||
if (!posToStartOffset.containsKey(pos)) {
|
||||
// First time we've seen a token leaving from this position:
|
||||
posToStartOffset.put(pos, startOffset);
|
||||
System.out.println(" + s " + pos + " -> " + startOffset);
|
||||
//System.out.println(" + s " + pos + " -> " + startOffset);
|
||||
} else {
|
||||
// We've seen a token leaving from this position
|
||||
// before; verify the startOffset is the same:
|
||||
System.out.println(" + vs " + pos + " -> " + startOffset);
|
||||
//System.out.println(" + vs " + pos + " -> " + startOffset);
|
||||
final int oldStartOffset = posToStartOffset.get(pos);
|
||||
if (oldStartOffset != startOffset) {
|
||||
throw new IllegalStateException(name + ": inconsistent startOffset as pos=" + pos + ": " + oldStartOffset + " vs " + startOffset + "; token=" + termAtt);
|
||||
throw new IllegalStateException(name + ": inconsistent startOffset at pos=" + pos + ": " + oldStartOffset + " vs " + startOffset + "; token=" + termAtt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,14 +107,14 @@ public final class ValidatingTokenFilter extends TokenFilter {
|
|||
if (!posToEndOffset.containsKey(endPos)) {
|
||||
// First time we've seen a token arriving to this position:
|
||||
posToEndOffset.put(endPos, endOffset);
|
||||
System.out.println(" + e " + endPos + " -> " + endOffset);
|
||||
//System.out.println(" + e " + endPos + " -> " + endOffset);
|
||||
} else {
|
||||
// We've seen a token arriving to this position
|
||||
// before; verify the endOffset is the same:
|
||||
System.out.println(" + ve " + endPos + " -> " + endOffset);
|
||||
//System.out.println(" + ve " + endPos + " -> " + endOffset);
|
||||
final int oldEndOffset = posToEndOffset.get(endPos);
|
||||
if (oldEndOffset != endOffset) {
|
||||
throw new IllegalStateException(name + ": inconsistent endOffset as pos=" + endPos + ": " + oldEndOffset + " vs " + endOffset + "; token=" + termAtt);
|
||||
throw new IllegalStateException(name + ": inconsistent endOffset at pos=" + endPos + ": " + oldEndOffset + " vs " + endOffset + "; token=" + termAtt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue