apache / apache/lucene

Throwing EOFException when reading past eof [LUCENE-9296]

Open
#10,336 0 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

When reading past eof, lucene can throw three types of exceptions. 

org.apache.lucene.store.BufferedIndexInput#readBytes throws EOFException

org.apache.lucene.codecs.compressing.CompressingTermVectorsReader.TVPostingsEnum#nextPosition throws IllegalStateException

org.apache.lucene.queryparser.classic.FastCharStream#refill throws IOException

 

When I implement my code, I have to handle three types of exceptions. Can the exceptions be made consistent? I feel that EOFException is the most reasonable exception.

---
Migrated from [LUCENE-9296](https://issues.apache.org/jira/browse/LUCENE-9296) by Hao Zhong

Contributor guide

Open the contributing guide

Research direction

Start by comparing BufferedIndexInput#readBytes, CompressingTermVectorsReader.TVPostingsEnum#nextPosition, and FastCharStream#refill, focusing on their behavior when reading past EOF. The work is done when these entry points consistently use EOFException instead of the currently mixed exception types.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.