Skip to content

Commit

Permalink
BUG: Lucene.Net.TestFramework.Analysis.ValidatingTokenFilter: Throw I…
Browse files Browse the repository at this point in the history
…nvalidOperationException instead of Exception (see #446).
  • Loading branch information
NightOwl888 committed Apr 26, 2021
1 parent 627fb48 commit 731c047
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Lucene.Net.TestFramework/Analysis/ValidatingTokenFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lucene.Net.Analysis.TokenAttributes;
using Lucene.Net.Analysis.TokenAttributes;
using System;
using System.Collections.Generic;

Expand Down Expand Up @@ -97,7 +97,7 @@ public override bool IncrementToken()
pos += posIncAtt.PositionIncrement;
if (pos == -1)
{
throw new Exception("first posInc must be > 0");
throw new InvalidOperationException("first posInc must be > 0");
}
}

Expand All @@ -110,7 +110,7 @@ public override bool IncrementToken()

if (offsetsAreCorrect && offsetAtt.StartOffset < lastStartOffset)
{
throw new Exception(name + ": offsets must not go backwards startOffset=" + startOffset + " is < lastStartOffset=" + lastStartOffset);
throw new InvalidOperationException(name + ": offsets must not go backwards startOffset=" + startOffset + " is < lastStartOffset=" + lastStartOffset);
}
lastStartOffset = offsetAtt.StartOffset;
}
Expand All @@ -132,7 +132,7 @@ public override bool IncrementToken()
//System.out.println(" + vs " + pos + " -> " + startOffset);
if (oldStartOffset != startOffset)
{
throw new Exception(name + ": inconsistent startOffset at pos=" + pos + ": " + oldStartOffset + " vs " + startOffset + "; token=" + termAtt);
throw new InvalidOperationException(name + ": inconsistent startOffset at pos=" + pos + ": " + oldStartOffset + " vs " + startOffset + "; token=" + termAtt);
}
}

Expand All @@ -151,7 +151,7 @@ public override bool IncrementToken()
//System.out.println(" + ve " + endPos + " -> " + endOffset);
if (oldEndOffset != endOffset)
{
throw new Exception(name + ": inconsistent endOffset at pos=" + endPos + ": " + oldEndOffset + " vs " + endOffset + "; token=" + termAtt);
throw new InvalidOperationException(name + ": inconsistent endOffset at pos=" + endPos + ": " + oldEndOffset + " vs " + endOffset + "; token=" + termAtt);
}
}
}
Expand Down

0 comments on commit 731c047

Please sign in to comment.