File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
log4j-core/src/main/java/org/apache/logging/log4j/core/pattern Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public String toString() {
6565 * Create a RegexReplacement.
6666 * @param regex The regular expression to locate.
6767 * @param replacement The replacement value.
68- * @return A RegexReplacement.
68+ * @return the new RegexReplacement instance or {@code null} if an input parameter was invalid
6969 */
7070 @ PluginFactory
7171 public static RegexReplacement createRegexReplacement (
@@ -76,6 +76,7 @@ public static RegexReplacement createRegexReplacement(
7676 }
7777 if (replacement == null ) {
7878 LOGGER .error ("A replacement string is required to perform replacement" );
79+ return null ;
7980 }
8081 // FIXME: should we use Matcher.quoteReplacement() here?
8182 return new RegexReplacement (regex , replacement );
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <entry xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xmlns =" https://logging.apache.org/xml/ns"
4+ xsi : schemaLocation =" https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
5+ type =" fixed" >
6+ <issue id =" 3215" link =" https://github.com/apache/logging-log4j2/issues/3215" />
7+ <description format =" asciidoc" >
8+ Properly handle null 'replacement' parameter in RegexReplacement#createRegexReplacement.
9+ </description >
10+ </entry >
You can’t perform that action at this time.
0 commit comments