Skip to content

setDelimiterSpecs() accumulates markLength instead of recalculating #354

Description

@elharo

In src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java, lines 133–141:

public AbstractFilterReaderLineEnding setDelimiterSpecs(Set<String> specs) {
    delimiters.clear();
    for (String spec : specs) {
        delimiters.add(DelimiterSpecification.parse(spec));
        markLength += spec.length() * 2;
    }
    return this;
}

markLength is accumulated on top of the current value rather than recalculated from base (255 + escapeString.length). If setDelimiterSpecs is called multiple times, markLength grows unbounded. Currently this is safe only because setEscapeString() always follows in Wrapper.getReader() and calls calculateMarkLength() which resets the value. However, this inter-call dependency is fragile and undocumented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions