JWT007 opened a new issue, #3239:
URL: https://github.com/apache/logging-log4j2/issues/3239

   In RegexFilter.Builder (2.24.1) the PluginAttribute for `useRawMsg` is a 
`Boolean` default `null`.
   
   ```
   @PluginFactory
   public static RegexFilter createFilter(
           // @formatter:off
           @PluginAttribute("regex") final String regex,
           @PluginElement("PatternFlags") final String[] patternFlags,
           @PluginAttribute("useRawMsg") final Boolean useRawMsg,
           @PluginAttribute("onMatch") final Result match,
           @PluginAttribute("onMismatch") final Result mismatch)
           // @formatter:on
           throws IllegalArgumentException, IllegalAccessException {
       if (regex == null) {
           LOGGER.error("A regular expression must be provided for 
RegexFilter");
           return null;
       }
       return new RegexFilter(useRawMsg, Pattern.compile(regex, 
toPatternFlags(patternFlags)), match, mismatch);
   }
   ```
   
   The `RegexFilter` constructor expects a boolean primitive.
   
   ```
   private RegexFilter(final boolean raw, final Pattern pattern, final Result 
onMatch, final Result onMismatch) {
       super(onMatch, onMismatch);
       this.pattern = pattern;
       this.useRawMessage = raw;
   }
   ```
   
   I believe, if the `useRawMsg` attribute is not set (undefined/null), 
auto-boxing from `Boolean` to `boolean` will cause/throw a NPE which is not 
caught and the builder will not return `null` as it *should*? 
   
   Also, the 'regex' attribute should probably be defined as @Required for the 
`isValid()` builder-functionality to work correctly.
   


-- 
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: notifications-unsubscr...@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to