In src/main/java/org/apache/maven/shared/filtering/AbstractFilterReaderLineEnding.java, lines 67–73:
public void setEscapeString(String escapeString) {
// TODO NPE if escapeString is null ?
if (escapeString != null && !escapeString.isEmpty()) {
this.escapeString = escapeString;
this.useEscape = true;
calculateMarkLength();
}
}
The code's own TODO acknowledges the problem. When escapeString is null:
this.escapeString retains its previous value (not cleared)
this.useEscape remains true if it was previously set from an earlier non-null call
calculateMarkLength() is not called, leaving markLength potentially wrong
A caller who sets escape string to non-null, then later sets it to null to disable escaping, will find escaping still active with the old string. The field should be cleared and useEscape set to false for null/empty input.
In
src/main/java/org/apache/maven/shared/filtering/AbstractFilterReaderLineEnding.java, lines 67–73:The code's own TODO acknowledges the problem. When
escapeStringisnull:this.escapeStringretains its previous value (not cleared)this.useEscaperemainstrueif it was previously set from an earlier non-null callcalculateMarkLength()is not called, leavingmarkLengthpotentially wrongA caller who sets escape string to non-null, then later sets it to null to disable escaping, will find escaping still active with the old string. The field should be cleared and
useEscapeset tofalsefor null/empty input.