apache / apache/lucene

RollingCharBuffer does not check all failed values.

Open
#13,513 0 comments 0 reactions 0 assignees View on GitHub
type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

The method code is as follows:

' public int get(int pos) throws IOException {
...
final int readCount = reader.read(buffer, nextWrite, toRead);
if (readCount == -1) {
end = true;
return -1;
}
'
When readCount fails, it can return 0. This value should aslo be checked.

https://github.com/apache/lucene/pull/13512

### Version and environment details

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with RollingCharBuffer.get(int pos) and inspect the reader.read call described in the issue. Review pull request 13512 for the related work; done means the method handles a zero readCount as well as -1 while preserving the existing end-of-input behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.