apache / apache/maven-filtering
BoundedReader recreated on every read() call
- Dominant language
- Java
- Stars
- 9
- Forks
- 36
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 4
Description
In `src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java`, line 207:
```
BoundedReader in = new BoundedReader(this.in, markLength);
```
A new `BoundedReader` is created on every single `read()` invocation. The constructor calls `this.in.mark(markLength)` on the shared `BufferedReader`, setting a new mark at the current stream position each time. This is:
- **Inefficient** — allocates a new wrapper object and resets the mark on every character read
- **Fragile** — if the underlying reader's mark buffer is insufficient between calls, `reset()` silently fails
The `BoundedReader` was designed for use within a single logical read operation but is being used as a disposable per-character wrapper.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java at line 207 and read the surrounding read() logic and BoundedReader usage. Trace how markLength and reset interact across calls, then inspect the existing test coverage for this reader. Done means repeated reads no longer recreate the wrapper unnecessarily and bounded mark/reset behavior remains reliable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100