logging-log4j2
logging-log4j2 copied to clipboard
RegexReplacement static factory method doesn't handle null 'replacement' attribute correctly
RegexReplacement#createRegexReplacement
Static builder method returns nullif the regexattribute is null, but although it logs an error it does not return null if the replacement attribute is null.
public static RegexReplacement createRegexReplacement(
@PluginAttribute("regex") final Pattern regex, @PluginAttribute("replacement") final String replacement) {
if (regex == null) {
LOGGER.error("A regular expression is required for replacement");
return null;
}
if (replacement == null) {
LOGGER.error("A replacement string is required to perform replacement");
}
// FIXME: should we use Matcher.quoteReplacement() here?
return new RegexReplacement(regex, replacement);
}
I can work on this @ppkarwasz feel free too assign this to me :)
@ppkarwasz - another small PR - simple fix
@jaykataria1111 - sorry to steal this one from you :( - its been a month and I am trying to close out some of the tickets I created before the next release.