Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed handling of null 'replacement' parameter in RegexReplacement#createRegexReplacement #3457

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public String toString() {
* Create a RegexReplacement.
* @param regex The regular expression to locate.
* @param replacement The replacement value.
* @return A RegexReplacement.
* @return the new RegexReplacement instance or {@code null} if an input parameter was invalid
*/
@PluginFactory
public static RegexReplacement createRegexReplacement(
Expand All @@ -76,6 +76,7 @@ public static RegexReplacement createRegexReplacement(
}
if (replacement == null) {
LOGGER.error("A replacement string is required to perform replacement");
return null;
}
// FIXME: should we use Matcher.quoteReplacement() here?
return new RegexReplacement(regex, replacement);
Expand Down
10 changes: 10 additions & 0 deletions src/changelog/2.25.0/3215_fix-RegexReplacement.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://logging.apache.org/xml/ns"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
type="fixed">
<issue id="3215" link="https://github.com/apache/logging-log4j2/issues/3215"/>
<description format="asciidoc">
Properly handle null 'replacement' parameter in RegexReplacement#createRegexReplacement.
</description>
</entry>
Loading