apache / apache/maven-filtering

setDelimiterSpecs() accumulates markLength instead of recalculating

Open Beginner friendly
#354 0 comments 0 reactions 0 assignees View on GitHub
bug
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`, lines 133–141:

```
public AbstractFilterReaderLineEnding setDelimiterSpecs(Set 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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java, focusing on setDelimiterSpecs() and calculateMarkLength(). Trace how markLength is initialized and updated, then verify that calling setDelimiterSpecs() repeatedly recalculates from the base value rather than accumulating. Run the relevant Maven test suite and add regression coverage if the existing tests do not exercise repeated calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.