[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new d2884ea9cc Refactor to avoid use of Hashtable. No functional change. d2884ea9cc is described below commit d2884ea9ccf7d8780515344cc7f1b172645b6c03 Author: Mark Thomas AuthorDate: Thu Sep 15 17:19:07 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- .../MbeansDescriptorsIntrospectionSource.java | 43 ++ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java index 1cb096c9be..05f393d023 100644 --- a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java +++ b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java @@ -21,9 +21,9 @@ import java.lang.reflect.Modifier; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import javax.management.ObjectName; @@ -94,7 +94,7 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource // Implementation for non-declared introspection classes -private static final Hashtable specialMethods = new Hashtable<>(); +private static final Map specialMethods = new HashMap<>(); static { specialMethods.put( "preDeregister", ""); specialMethods.put( "postDeregister", ""); @@ -194,9 +194,9 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource * @param setAttMap The settable attributes map * @param invokeAttMap The invokable attributes map */ -private void initMethods(Class realClass, Method methods[], Hashtable attMap, -Hashtable getAttMap, Hashtable setAttMap, -Hashtable invokeAttMap) { +private void initMethods(Class realClass, Method methods[], Map attMap, +Map getAttMap, Map setAttMap, +Map invokeAttMap) { for (Method method : methods) { String name = method.getName(); @@ -294,32 +294,29 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource Method methods[]=null; -Hashtable attMap = new Hashtable<>(); +Map attMap = new HashMap<>(); // key: attribute val: getter method -Hashtable getAttMap = new Hashtable<>(); +Map getAttMap = new HashMap<>(); // key: attribute val: setter method -Hashtable setAttMap = new Hashtable<>(); +Map setAttMap = new HashMap<>(); // key: operation val: invoke method -Hashtable invokeAttMap = new Hashtable<>(); +Map invokeAttMap = new HashMap<>(); methods = realClass.getMethods(); initMethods(realClass, methods, attMap, getAttMap, setAttMap, invokeAttMap ); try { - -Enumeration en = attMap.keys(); -while( en.hasMoreElements() ) { -String name = en.nextElement(); -AttributeInfo ai=new AttributeInfo(); -ai.setName( name ); -Method gm = getAttMap.get(name); -if( gm!=null ) { -//ai.setGetMethodObj( gm ); -ai.setGetMethod( gm.getName()); -Class t=gm.getReturnType(); -if( t!=null ) { -ai.setType( t.getName() ); +for (Entry attEntry : attMap.entrySet()) { +String name = attEntry.getKey(); +AttributeInfo ai = new AttributeInfo(); +ai.setName(name); +Method gm = attEntry.getValue(); +if (gm != null) { +ai.setGetMethod(gm.getName()); +Class t = gm.getReturnType(); +if (t != null) { +ai.setType(t.getName()); } } Method sm = setAttMap.get(name); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 0fa8cf9a18 Refactor to avoid use of Hashtable. No functional change. 0fa8cf9a18 is described below commit 0fa8cf9a185f699c74307c5a91b67958f5d7443d Author: Mark Thomas AuthorDate: Thu Sep 15 17:04:39 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- java/org/apache/naming/ContextAccessController.java | 7 --- java/org/apache/naming/ContextBindings.java | 13 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/java/org/apache/naming/ContextAccessController.java b/java/org/apache/naming/ContextAccessController.java index 301d648eea..0fad089be5 100644 --- a/java/org/apache/naming/ContextAccessController.java +++ b/java/org/apache/naming/ContextAccessController.java @@ -16,7 +16,8 @@ */ package org.apache.naming; -import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * Handles the access control on the JNDI contexts. @@ -30,13 +31,13 @@ public class ContextAccessController { /** * Catalina context names on which writing is not allowed. */ -private static final Hashtable readOnlyContexts = new Hashtable<>(); +private static final Map readOnlyContexts = new ConcurrentHashMap<>(); /** * Security tokens repository. */ -private static final Hashtable securityTokens = new Hashtable<>(); +private static final Map securityTokens = new ConcurrentHashMap<>(); // - Public Methods diff --git a/java/org/apache/naming/ContextBindings.java b/java/org/apache/naming/ContextBindings.java index ae509b27b7..baf3ce2bdb 100644 --- a/java/org/apache/naming/ContextBindings.java +++ b/java/org/apache/naming/ContextBindings.java @@ -16,7 +16,8 @@ */ package org.apache.naming; -import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import javax.naming.Context; import javax.naming.NamingException; @@ -42,31 +43,31 @@ public class ContextBindings { /** * Bindings object - naming context. Keyed by object. */ -private static final Hashtable objectBindings = new Hashtable<>(); +private static final Map objectBindings = new ConcurrentHashMap<>(); /** * Bindings thread - naming context. Keyed by thread. */ -private static final Hashtable threadBindings = new Hashtable<>(); +private static final Map threadBindings = new ConcurrentHashMap<>(); /** * Bindings thread - object. Keyed by thread. */ -private static final Hashtable threadObjectBindings = new Hashtable<>(); +private static final Map threadObjectBindings = new ConcurrentHashMap<>(); /** * Bindings class loader - naming context. Keyed by class loader. */ -private static final Hashtable clBindings = new Hashtable<>(); +private static final Map clBindings = new ConcurrentHashMap<>(); /** * Bindings class loader - object. Keyed by class loader. */ -private static final Hashtable clObjectBindings = new Hashtable<>(); +private static final Map clObjectBindings = new ConcurrentHashMap<>(); /** - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 1f380e3a40 Refactor to avoid use of Hashtable. No functional change. 1f380e3a40 is described below commit 1f380e3a40395f911e0f52d33643b3693f5753c4 Author: Mark Thomas AuthorDate: Thu Sep 15 16:54:30 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- java/org/apache/jasper/compiler/Generator.java | 29 +- .../apache/jasper/compiler/TagLibraryInfoImpl.java | 4 +-- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 45ff4a03d8..b0c83469ed 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -29,10 +29,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; -import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; -import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -911,9 +909,9 @@ class Generator { * handlers: : tag short name : introspection info of tag * handler for tag */ -private final Hashtable> handlerInfos; +private final Map> handlerInfos; -private final Hashtable tagVarNumbers; +private final Map tagVarNumbers; private String parent; @@ -951,8 +949,8 @@ class Generator { this.methodsBuffered = methodsBuffered; this.fragmentHelperClass = fragmentHelperClass; methodNesting = 0; -handlerInfos = new Hashtable<>(); -tagVarNumbers = new Hashtable<>(); +handlerInfos = new HashMap<>(); +tagVarNumbers = new HashMap<>(); textMap = new HashMap<>(); } @@ -2026,7 +2024,7 @@ class Generator { // Compute attribute value string for XML-style and named // attributes -Hashtable map = new Hashtable<>(); +Map map = new HashMap<>(); // Validator ensures this is non-null Node.JspAttribute[] attrs = n.getJspAttributes(); for (int i = 0; i < attrs.length; i++) { @@ -2071,9 +2069,7 @@ class Generator { out.print(" + " + elemName); // Write remaining attributes -Enumeration enumeration = map.keys(); -while (enumeration.hasMoreElements()) { -String attrName = enumeration.nextElement(); +for (String attrName : map.keySet()) { out.print(map.get(attrName)); } @@ -2369,10 +2365,9 @@ class Generator { private TagHandlerInfo getTagHandlerInfo(Node.CustomTag n) throws JasperException { -Hashtable handlerInfosByShortName = -handlerInfos.get(n.getPrefix()); +Map handlerInfosByShortName = handlerInfos.get(n.getPrefix()); if (handlerInfosByShortName == null) { -handlerInfosByShortName = new Hashtable<>(); +handlerInfosByShortName = new HashMap<>(); handlerInfos.put(n.getPrefix(), handlerInfosByShortName); } TagHandlerInfo handlerInfo = @@ -4045,9 +4040,9 @@ class Generator { */ private static class TagHandlerInfo { -private Hashtable methodMaps; +private Map methodMaps; -private Hashtable> propertyEditorMaps; +private Map> propertyEditorMaps; private Class tagHandlerClass; @@ -4065,8 +4060,8 @@ class Generator { TagHandlerInfo(Node n, Class tagHandlerClass, ErrorDispatcher err) throws JasperException { this.tagHandlerClass = tagHandlerClass; -this.methodMaps = new Hashtable<>(); -this.propertyEditorMaps = new Hashtable<>(); +this.methodMaps = new HashMap<>(); +this.propertyEditorMaps = new HashMap<>(); try { BeanInfo tagClassInfo = Introspector.getBeanInfo(tagHandlerClass); diff --git a/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java b/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java index 949df622d8..10f44af3c9 100644 --- a/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java +++ b/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java @@ -25,8 +25,8 @@ import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; -import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; @@ -349,7 +349,7 @@ class TagLibraryInfoImpl extends TagLibraryInfo
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 1361ae0da6 Refactor to avoid use of Hashtable. No functional change. 1361ae0da6 is described below commit 1361ae0da6d6f87353a221c2930a2458c956ac01 Author: Mark Thomas AuthorDate: Thu Sep 15 15:48:18 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- java/org/apache/catalina/valves/rewrite/RewriteValve.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/valves/rewrite/RewriteValve.java b/java/org/apache/catalina/valves/rewrite/RewriteValve.java index 53f8fc8fb6..29929843af 100644 --- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java +++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java @@ -24,10 +24,10 @@ import java.io.StringReader; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.StringTokenizer; +import java.util.concurrent.ConcurrentHashMap; import javax.servlet.ServletException; import javax.servlet.http.Cookie; @@ -102,7 +102,7 @@ public class RewriteValve extends ValveBase { /** * Maps to be used by the rules. */ -protected Map maps = new Hashtable<>(); +protected Map maps = new ConcurrentHashMap<>(); /** - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 02f82e801e Refactor to avoid use of Hashtable. No functional change. 02f82e801e is described below commit 02f82e801e02b642c85d5eaefa0246e66b8a5a29 Author: Mark Thomas AuthorDate: Thu Sep 15 15:40:00 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- java/javax/servlet/jsp/tagext/TagSupport.java | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/java/javax/servlet/jsp/tagext/TagSupport.java b/java/javax/servlet/jsp/tagext/TagSupport.java index b70cf8207d..cd13d42bf7 100644 --- a/java/javax/servlet/jsp/tagext/TagSupport.java +++ b/java/javax/servlet/jsp/tagext/TagSupport.java @@ -17,8 +17,10 @@ package javax.servlet.jsp.tagext; import java.io.Serializable; +import java.util.Collections; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; @@ -230,7 +232,7 @@ public class TagSupport implements IterationTag, Serializable { */ public void setValue(String k, Object o) { if (values == null) { -values = new Hashtable<>(); +values = new ConcurrentHashMap<>(); } values.put(k, o); } @@ -269,7 +271,7 @@ public class TagSupport implements IterationTag, Serializable { if (values == null) { return null; } -return values.keys(); +return Collections.enumeration(values.keySet()); } /** @@ -280,7 +282,7 @@ public class TagSupport implements IterationTag, Serializable { /** * Map of object values keyed by Strings for this tag. */ -private Hashtable values; +private Map values; /** * The value of the id attribute of this tag; or null. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 86813018df Refactor to avoid use of Hashtable. No functional change. 86813018df is described below commit 86813018df7cffce08228d1f75d5bf7ed66de6bc Author: Mark Thomas AuthorDate: Wed Sep 14 19:44:37 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- java/org/apache/catalina/tribes/util/StringManager.java | 5 ++--- java/org/apache/naming/StringManager.java | 6 +++--- java/org/apache/tomcat/util/res/StringManager.java | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/java/org/apache/catalina/tribes/util/StringManager.java b/java/org/apache/catalina/tribes/util/StringManager.java index 0979c469a6..ed689fdb8c 100644 --- a/java/org/apache/catalina/tribes/util/StringManager.java +++ b/java/org/apache/catalina/tribes/util/StringManager.java @@ -18,7 +18,7 @@ package org.apache.catalina.tribes.util; import java.text.MessageFormat; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Locale; import java.util.Map; @@ -180,8 +180,7 @@ public class StringManager { // STATIC SUPPORT METHODS // -- -private static final Map> managers = -new Hashtable<>(); +private static final Map> managers = new HashMap<>(); /** diff --git a/java/org/apache/naming/StringManager.java b/java/org/apache/naming/StringManager.java index 0a4c3699ce..b20094d071 100644 --- a/java/org/apache/naming/StringManager.java +++ b/java/org/apache/naming/StringManager.java @@ -17,8 +17,9 @@ package org.apache.naming; import java.text.MessageFormat; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Locale; +import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -155,8 +156,7 @@ public class StringManager { // STATIC SUPPORT METHODS // -- -private static final Hashtable managers = -new Hashtable<>(); +private static final Map managers = new HashMap<>(); /** * Get the StringManager for a particular package. If a manager for diff --git a/java/org/apache/tomcat/util/res/StringManager.java b/java/org/apache/tomcat/util/res/StringManager.java index d9e11bb86e..91b39b48d7 100644 --- a/java/org/apache/tomcat/util/res/StringManager.java +++ b/java/org/apache/tomcat/util/res/StringManager.java @@ -18,7 +18,7 @@ package org.apache.tomcat.util.res; import java.text.MessageFormat; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Locale; import java.util.Map; @@ -187,8 +187,7 @@ public class StringManager { // STATIC SUPPORT METHODS // -- -private static final Map> managers = -new Hashtable<>(); +private static final Map> managers = new HashMap<>(); /** - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new f36d28ec85 Refactor to avoid use of Hashtable. No functional change. f36d28ec85 is described below commit f36d28ec85dd9338eedd4146a03525e272ee92bd Author: Mark Thomas 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 homes = new Hashtable<>(); +private final Map 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 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 homes = new Hashtable<>(); +private final Map 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 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
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 1fedce1b15 Refactor to avoid use of Hashtable. No functional change. 1fedce1b15 is described below commit 1fedce1b153e03d4b209b1db59005ddef655e89f Author: Mark Thomas AuthorDate: Wed Sep 14 19:22:43 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- java/org/apache/catalina/ha/session/DeltaSession.java | 3 +-- java/org/apache/catalina/session/StandardSession.java | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java b/java/org/apache/catalina/ha/session/DeltaSession.java index 2b72a3ab36..f2640a7f8f 100644 --- a/java/org/apache/catalina/ha/session/DeltaSession.java +++ b/java/org/apache/catalina/ha/session/DeltaSession.java @@ -27,7 +27,6 @@ import java.io.Serializable; import java.io.WriteAbortedException; import java.security.Principal; import java.util.ArrayList; -import java.util.Hashtable; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; @@ -959,7 +958,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus } if (notes == null) { -notes = new Hashtable<>(); +notes = new ConcurrentHashMap<>(); } activate(); } diff --git a/java/org/apache/catalina/session/StandardSession.java b/java/org/apache/catalina/session/StandardSession.java index 4afd6662e1..ae906c67fc 100644 --- a/java/org/apache/catalina/session/StandardSession.java +++ b/java/org/apache/catalina/session/StandardSession.java @@ -31,7 +31,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; -import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -227,7 +226,7 @@ public class StandardSession implements HttpSession, Session, Serializable { * and event listeners. IMPLEMENTATION NOTE: This object is * not saved and restored across session serializations! */ -protected transient Map notes = new Hashtable<>(); +protected transient Map notes = new ConcurrentHashMap<>(); /** @@ -1576,7 +1575,7 @@ public class StandardSession implements HttpSession, Session, Serializable { } if (notes == null) { -notes = new Hashtable<>(); +notes = new ConcurrentHashMap<>(); } /* * The next object read could either be the number of attributes - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated: Refactor to avoid use of Hashtable. No functional change.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 0a3110006f Refactor to avoid use of Hashtable. No functional change. 0a3110006f is described below commit 0a3110006f469fe2beb99c3a96599e2cf3b2bab7 Author: Mark Thomas AuthorDate: Wed Sep 14 19:18:47 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- webapps/examples/WEB-INF/classes/cal/Entries.java | 7 --- webapps/examples/WEB-INF/classes/cal/TableBean.java | 19 ++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/webapps/examples/WEB-INF/classes/cal/Entries.java b/webapps/examples/WEB-INF/classes/cal/Entries.java index 4b3a5ee1e3..cac611a03b 100644 --- a/webapps/examples/WEB-INF/classes/cal/Entries.java +++ b/webapps/examples/WEB-INF/classes/cal/Entries.java @@ -16,19 +16,20 @@ */ package cal; -import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import javax.servlet.http.HttpServletRequest; public class Entries { -private final Hashtable entries; +private final Map entries; private static final String[] time = { "8am", "9am", "10am", "11am", "12pm", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm" }; public static final int rows = 12; public Entries() { -entries = new Hashtable<>(rows); +entries = new ConcurrentHashMap<>(rows); for (int i = 0; i < rows; i++) { entries.put(time[i], new Entry(time[i])); } diff --git a/webapps/examples/WEB-INF/classes/cal/TableBean.java b/webapps/examples/WEB-INF/classes/cal/TableBean.java index 1a871ae28b..9f1cc4a6cf 100644 --- a/webapps/examples/WEB-INF/classes/cal/TableBean.java +++ b/webapps/examples/WEB-INF/classes/cal/TableBean.java @@ -16,22 +16,23 @@ */ package cal; -import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import javax.servlet.http.HttpServletRequest; public class TableBean { -final Hashtable table; -final JspCalendar JspCal; -Entries entries; -String date; -String name = null; -String email = null; -boolean processError = false; +private final Map table; +private final JspCalendar JspCal; +private Entries entries; +private String date; +private String name = null; +private String email = null; +private boolean processError = false; public TableBean() { -this.table = new Hashtable<>(10); +this.table = new ConcurrentHashMap<>(10); this.JspCal = new JspCalendar(); this.date = JspCal.getCurrentDate(); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org