-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
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)
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done