jmestwa-coder opened a new pull request, #671:
URL: https://github.com/apache/logging-log4cxx/pull/671

   ## Summary
   Prevent rollover failures when using short file name patterns in 
`FixedWindowRollingPolicy`.
   
   ## What Changed
   - Replaced manual suffix offset comparisons with `StringHelper::endsWith()`
   - Removed unsafe `length() - N` arithmetic for `.gz` and `.zip` suffix checks
   - Added a regression test covering short patterns such as `R%i`
   
   ## Problem
   Short valid patterns like:
   
   ```text
   R%i
   ```
   
   can generate file names shorter than the suffix length being checked.
   
   The previous implementation performed:
   
   ```cpp
   lowFilename.compare(lowFilename.length() - 3, ...)
   ```
   
   which could produce an invalid string position and cause rollover to fail 
with:
   
   ```text
   log4cxx: invalid string position
   ```
   
   ## Regression Test
   Added `testShortPatternRegression` to verify:
   - rollover fails before the fix
   - rollover succeeds after the fix
   - the rolled file is created successfully
   
   ## Validation
   - Verified failing behavior on the original implementation
   - Verified passing behavior after the fix
   - Re-ran the regression test multiple times to confirm deterministic behavior


-- 
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]

Reply via email to