vpelikh opened a new pull request, #4153: URL: https://github.com/apache/logging-log4j2/pull/4153
Ports #3158 from the 2.x branch to 3.x. ## Changes - **StringMatchFilter.java**: Added `@Required` constraint annotation on the `text` builder field, `Assert.requireNonEmpty` checks in the constructor and `setMatchString()` method, and a null/empty validation guard in `build()` returning the null filter sentinel when validation fails - **StringMatchFilterTest.java**: Added 5 test methods covering valid construction, empty `text` rejection, null `text` rejection, missing attribute rejection, and post-stop guard - **Test configs**: Added `log4j2-stringmatchfilter-3153-ok.xml` and `log4j2-stringmatchfilter-3153-nok.xml` fixture configurations ## Why An empty or missing `text` attribute on `StringMatchFilter` previously resulted in either a cryptic `NullPointerException` at runtime (after `stop()`) or silently matching the empty string against every event. This change provides clear validation at configuration time and graceful degradation. -- 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]
