Avoid NPEs in edge cases for bridge clients.
@@ -644,13 +644,14 @@ public class PropertyConfigurator implements Configurator {
private void parseErrorHandler(final ErrorHandler errorHandler, final String errorHandlerPrefix, final Properties props,
final LoggerRepository loggerRepository) {
+ if (errorHandler != null && loggerRepository != null) {
final boolean rootRef = OptionConverter.toBoolean(OptionConverter.findAndSubst(errorHandlerPrefix + ROOT_REF, props), false);
if (rootRef) {
errorHandler.setLogger(loggerRepository.getRootLogger());
}
final String loggerName = OptionConverter.findAndSubst(errorHandlerPrefix + LOGGER_REF, props);
if (loggerName != null) {
- final Logger logger = (loggerFactory == null) ? loggerRepository.getLogger(loggerName) : loggerRepository.getLogger(loggerName, loggerFactory);
+ final Logger logger = loggerFactory == null ? loggerRepository.getLogger(loggerName) : loggerRepository.getLogger(loggerName, loggerFactory);
errorHandler.setLogger(logger);
}
final String appenderName = OptionConverter.findAndSubst(errorHandlerPrefix + APPENDER_REF_TAG, props);
@@ -661,6 +662,7 @@ public class PropertyConfigurator implements Configurator {
}
}
}
+ }
Appender registryGet(final String name) {
return (Appender) registry.get(name);
