You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "vpelikh (via GitHub)" <gi...@apache.org> on 2026/06/26 06:54:33 UTC

[PR] [main] Fix RegexFilter NPE when `useRawMsg` is null (#3265) [logging-log4j2]

vpelikh opened a new pull request, #4152:
URL: https://github.com/apache/logging-log4j2/pull/4152

   Ports the fix from **#3265** from the `2.x` branch to `main`.
   
   In the `RegexFilter.createFilter()` factory method, the `useRawMsg` parameter is declared as `Boolean` (boxed). When passed directly to the `RegexFilter(boolean raw, ...)` constructor, a `null` value causes an NPE during unboxing.
   
   This change uses `Boolean.TRUE.equals(useRawMsg)` instead, which safely handles `null` by defaulting to `false`.
   
   ## Changes
   
   - **`log4j-core/.../filter/RegexFilter.java`**: Changed `useRawMsg` → `Boolean.TRUE.equals(useRawMsg)` in constructor call
   - **`log4j-core-test/.../filter/RegexFilterTest.java`**: Added test ensuring no exception when `useRawMsg` is `null`
   


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [main] Fix RegexFilter NPE when `useRawMsg` is null (#3265 port) [logging-log4j2]

Posted by "ramanathan1504 (via GitHub)" <gi...@apache.org>.
ramanathan1504 commented on PR #4152:
URL: https://github.com/apache/logging-log4j2/pull/4152#issuecomment-4990269504

   @vpelikh 
   For future PRs, please make sure to check our [Development Guidelines (BUILDING.adoc)](https://www.google.com/url?sa=E&q=https%3A%2F%2Fgithub.com%2Fapache%2Flogging-log4j2%2Fblob%2Fmain%2FBUILDING.adoc) and run ./mvnw verify (or at least ./mvnw spotless:apply) locally before committing. This will help catch these formatting errors before the CI does!


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [main] Fix RegexFilter NPE when `useRawMsg` is null (#3265 port) [logging-log4j2]

Posted by "ramanathan1504 (via GitHub)" <gi...@apache.org>.
ramanathan1504 commented on PR #4152:
URL: https://github.com/apache/logging-log4j2/pull/4152#issuecomment-4989284506

   Thanks for the update, @vpelikh!
   
   One quick request for the future: please try to avoid force-pushing when updating a PR. While it's fine for this because here there in no PR review comments, force-pushing erases the commit history and makes it very difficult for us to review iterative changes.
   
   Everything else looks perfect. Thanks


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [main] Fix RegexFilter NPE when `useRawMsg` is null (#3265 port) [logging-log4j2]

Posted by "vpelikh (via GitHub)" <gi...@apache.org>.
vpelikh commented on PR #4152:
URL: https://github.com/apache/logging-log4j2/pull/4152#issuecomment-4989283797

   Thank you for the review, @ramanathan1504!
   
   I've removed the changelog file from this PR. I also just went through all my other open backport PRs a few minutes ago and cleaned up the changelog entries there, so they should all be consistent now and won't cause any extra noise.


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [main] Fix RegexFilter NPE when `useRawMsg` is null (#3265 port) [logging-log4j2]

Posted by "ramanathan1504 (via GitHub)" <gi...@apache.org>.
ramanathan1504 commented on PR #4152:
URL: https://github.com/apache/logging-log4j2/pull/4152#issuecomment-4989030788

   @vpelikh, Looks good, the fix and tests work perfectly locally and adapt well to the Log4j 3 variables.
   
   However, we don't port changelog entries for direct syncs from 2.x to main. Please delete the changelog file (src/changelog/.3.x.x/3239_npe_fix_regex_filter_creator.xml). I'll merge this as soon as it's removed!


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [main] Fix RegexFilter NPE when `useRawMsg` is null (#3265 port) [logging-log4j2]

Posted by "ramanathan1504 (via GitHub)" <gi...@apache.org>.
ramanathan1504 merged PR #4152:
URL: https://github.com/apache/logging-log4j2/pull/4152


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org