Skip to content

BoundedReader recreated on every read() call #353

Description

@elharo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions