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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git

commit 704258ca417e988218aab6f719299620436d73a5
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Nov 19 16:30:24 2023 -0500

    Use Map API
---
 .../java/org/apache/commons/logging/impl/LogFactoryImpl.java     | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java 
b/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
index 354c282..a03717b 100644
--- a/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
+++ b/src/main/java/org/apache/commons/logging/impl/LogFactoryImpl.java
@@ -254,7 +254,7 @@ public class LogFactoryImpl extends LogFactory {
      * The {@link org.apache.commons.logging.Log} instances that have
      * already been created, keyed by logger name.
      */
-    protected Hashtable instances = new Hashtable();
+    protected Hashtable<String, Log> instances = new Hashtable<>();
 
     /**
      * Name of the class implementing the Log interface.
@@ -846,12 +846,7 @@ public class LogFactoryImpl extends LogFactory {
      */
     @Override
     public Log getInstance(final String name) throws LogConfigurationException 
{
-        Log instance = (Log) instances.get(name);
-        if (instance == null) {
-            instance = newInstance(name);
-            instances.put(name, instance);
-        }
-        return instance;
+        return instances.computeIfAbsent(name, this::newInstance);
     }
 
     /**

Reply via email to