This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 1115f37ada Refactor to avoid use of Hashtable. No functional change. 1115f37ada is described below commit 1115f37ada93fd6e07511604ed857eecdbd7882a 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 bbcb090d20..a0be2dbc5f 100644 --- a/java/org/apache/catalina/startup/HomesUserDatabase.java +++ b/java/org/apache/catalina/startup/HomesUserDatabase.java @@ -17,8 +17,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; /** * Concrete implementation of the <code>UserDatabase</code> interface @@ -32,7 +34,7 @@ public final class HomesUserDatabase implements UserDatabase { /** * 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<>(); /** * The UserConfig listener with which we are associated. @@ -73,11 +75,11 @@ public final class HomesUserDatabase 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()); } 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