This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 78f728af516564031cbcd0d2a6733c3d6dc44ec2
Author: Matt Sicker <[email protected]>
AuthorDate: Sun Oct 1 17:31:21 2023 -0500

    Add some javadocs
    
    Signed-off-by: Matt Sicker <[email protected]>
---
 .../src/main/java/org/apache/logging/log4j/util/Cast.java    | 12 ++++++++++++
 .../logging/log4j/core/config/AbstractConfiguration.java     |  7 +++++++
 2 files changed, 19 insertions(+)

diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/Cast.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/Cast.java
index c525bc42d0..8a1dc40975 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/Cast.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Cast.java
@@ -18,7 +18,19 @@ package org.apache.logging.log4j.util;
 
 @InternalApi
 public final class Cast {
+
+    /**
+     * Returns the provided object cast to the generic parameter type or null 
when the argument is null.
+     *
+     * @param o   object to cast
+     * @param <T> the type to cast
+     * @return object after casting or null if the object was null
+     * @throws ClassCastException if the object cannot be cast to the provided 
type
+     */
     public static <T> T cast(final Object o) {
+        if (o == null) {
+            return null;
+        }
         @SuppressWarnings("unchecked") final T t = (T) o;
         return t;
     }
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
index bb434ab654..ebf083b0da 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
@@ -94,8 +94,15 @@ import org.apache.logging.log4j.util.ServiceRegistry;
  */
 public abstract class AbstractConfiguration extends AbstractFilterable 
implements Configuration {
 
+    /**
+     * The instance factory for this configuration. This may be a child 
factory to a LoggerContext
+     * in most cases, though this might be a root level factory for null 
configurations.
+     */
     protected final ConfigurableInstanceFactory instanceFactory;
 
+    /**
+     * The configuration processor for transforming a node tree into plugin 
instances.
+     */
     protected final ConfigurationProcessor configurationProcessor;
 
     /**

Reply via email to