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

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
     new 317afcf5b8 Refactor to avoid use of Hashtable. No functional change.
317afcf5b8 is described below

commit 317afcf5b874b0a6d4445f620ba2331124c17e76
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Sep 14 19:29:18 2022 +0100

    Refactor to avoid use of Hashtable. No functional change.
---
 java/org/apache/catalina/startup/HomesUserDatabase.java  | 10 ++++++----
 java/org/apache/catalina/startup/PasswdUserDatabase.java | 12 +++++++-----
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/startup/HomesUserDatabase.java 
b/java/org/apache/catalina/startup/HomesUserDatabase.java
index 0b858c1df9..1a77c16fa8 100644
--- a/java/org/apache/catalina/startup/HomesUserDatabase.java
+++ b/java/org/apache/catalina/startup/HomesUserDatabase.java
@@ -18,8 +18,10 @@ package org.apache.catalina.startup;
 
 
 import java.io.File;
+import java.util.Collections;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
 
 
 /**
@@ -52,7 +54,7 @@ public final class HomesUserDatabase
     /**
      * The set of home directories for all defined users, keyed by username.
      */
-    private final Hashtable<String,String> homes = new Hashtable<>();
+    private final Map<String,String> homes = new HashMap<>();
 
 
     /**
@@ -100,11 +102,11 @@ public final class HomesUserDatabase
 
 
     /**
-     * Return an enumeration of the usernames defined on this server.
+     * Return an enumeration of the user names defined on this server.
      */
     @Override
     public Enumeration<String> getUsers() {
-        return homes.keys();
+        return Collections.enumeration(homes.keySet());
     }
 
 
diff --git a/java/org/apache/catalina/startup/PasswdUserDatabase.java 
b/java/org/apache/catalina/startup/PasswdUserDatabase.java
index 893557ad81..3cfc9f7fd1 100644
--- a/java/org/apache/catalina/startup/PasswdUserDatabase.java
+++ b/java/org/apache/catalina/startup/PasswdUserDatabase.java
@@ -18,8 +18,10 @@ package org.apache.catalina.startup;
 
 import java.io.BufferedReader;
 import java.io.FileReader;
+import java.util.Collections;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -43,9 +45,9 @@ public final class PasswdUserDatabase implements UserDatabase 
{
 
 
     /**
-     * The set of home directories for all defined users, keyed by username.
+     * The set of home directories for all defined users, keyed by user name.
      */
-    private final Hashtable<String,String> homes = new Hashtable<>();
+    private final Map<String,String> homes = new HashMap<>();
 
 
     /**
@@ -87,11 +89,11 @@ public final class PasswdUserDatabase implements 
UserDatabase {
 
 
     /**
-     * Return an enumeration of the usernames defined on this server.
+     * Return an enumeration of the user names defined on this server.
      */
     @Override
     public Enumeration<String> getUsers() {
-        return homes.keys();
+        return Collections.enumeration(homes.keySet());
     }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to