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

   AsyncWaitStrategyFactoryConfig (Log4j 2.24.1)
   
   This @Plugin doesn't behave like most others where if the configuration is 
invalid, it will return a `null` from the Builder.
   
   The `@PluginBuilderAttribute` `factoryClassName` (for the XML `class` 
attribute) is marked as `@Required`, but if creating programatically the 
missing value is not checked and the constructor will throw a NPE.
   
   ```
   @Override
   public AsyncWaitStrategyFactoryConfig build() {
       return new AsyncWaitStrategyFactoryConfig(factoryClassName);
   }
   ```
   
   ```
   public AsyncWaitStrategyFactoryConfig(final String factoryClassName) {
       this.factoryClassName = Objects.requireNonNull(factoryClassName, 
"factoryClassName");
   }
   ```
   
   Typical behaviour here would be to return `null` from the `build()` method 
if misconfigured.
   
   * adding a NotEmpty check to the `Builder#withFactoryClassName(...)` method 
might be sensible.
   * adding a NotEmpty check to the constructor might be sensible (an empty 
string here makes no sense)
   
   


-- 
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