elharo opened a new pull request, #373:
URL: https://github.com/apache/maven-filtering/pull/373
## Problem
`setEscapeString(null)` and `setEscapeString("")` were silently ignored in
`AbstractFilterReaderLineEnding`. When called after a previous non-null value,
the old escape string and `useEscape` flag were retained, so escaping remained
active.
## Fix
Changed `setEscapeString` to explicitly clear `escapeString` to `null` and
`useEscape` to `false` when the input is null or empty, and moved
`calculateMarkLength()` outside the conditional so it's always called.
## Tests
Added two tests that verify both `null` and empty string properly disable
escaping:
- `setEscapeStringNullShouldDisableEscaping` -- sets escape to `\\`, then
`null`, asserts `getEscapeString()` returns null
- `setEscapeStringEmptyShouldDisableEscaping` -- sets escape to `\\`, then
`""`, asserts `getEscapeString()` returns null
Both tests fail before the fix (`expected: <null> but was: <\>`) and pass
after. All 75 tests pass.
Closes #351
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]