Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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.x.x/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>