ppkarwasz commented on code in PR #1961:
URL: https://github.com/apache/logging-log4j2/pull/1961#discussion_r1392240342


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java:
##########
@@ -82,35 +84,31 @@ static int calculateRingBufferSize(final String 
propertyName) {
     }
 
     static ExceptionHandler<RingBufferLogEvent> 
getAsyncLoggerExceptionHandler() {
-        final String cls = 
PropertiesUtil.getProperties().getStringProperty("AsyncLogger.ExceptionHandler");
-        if (cls == null) {
-            return new AsyncLoggerDefaultExceptionHandler();
-        }
+        ExceptionHandler<RingBufferLogEvent> handler = null;
         try {
-            @SuppressWarnings("unchecked")
-            final Class<? extends ExceptionHandler<RingBufferLogEvent>> klass =
-                (Class<? extends ExceptionHandler<RingBufferLogEvent>>) 
Loader.loadClass(cls);
-            return klass.newInstance();
-        } catch (final Exception ignored) {
-            LOGGER.debug("Invalid AsyncLogger.ExceptionHandler value: error 
creating {}: ", cls, ignored);
-            return new AsyncLoggerDefaultExceptionHandler();
+            handler =

Review Comment:
   
[`LoaderUtil.newCheckedInstanceOfProperty`](https://github.com/apache/logging-log4j2/blob/ce3a6de7a53a879764dadf01aae35298a039e6be/log4j-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java#L330)
 can return `null` if the property is not defined. Since instantiation can also 
fail, leaving the variable at its default value of `null`, I do a single 
null-check for both cases.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to