File tree Expand file tree Collapse file tree
src/Lucene.Net/Support/Store Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,21 +187,24 @@ protected void EnsureOpen()
187187
188188 public override void Seek ( long pos )
189189 {
190- if ( pos < 0 || pos > length )
190+ if ( ( uint ) pos > ( uint ) length )
191191 {
192- throw new IOException ( "Seek position is out of bounds: " + pos ) ;
192+ throw new ArgumentOutOfRangeException ( nameof ( pos ) , $ "Seek position is out of bounds: { pos } " ) ;
193193 }
194+
194195 if ( Volatile . Read ( ref instanceClosed ) != 0 )
195196 {
196197 throw AlreadyClosedException . Create ( this . GetType ( ) . FullName , "Already disposed: " + this ) ;
197198 }
199+
198200 // If the seek stays inside the cached chunk, keep the cached pointer and
199201 // just move the cursor; otherwise invalidate so the next read reacquires.
200202 if ( currentChunkIndex != NO_CHUNK && pos >= currentStart && pos < currentEnd )
201203 {
202204 position = pos ;
203205 return ;
204206 }
207+
205208 ReleaseCurrentChunk ( ) ;
206209 position = pos ;
207210 }
You can’t perform that action at this time.
0 commit comments