[tomcat] branch 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 9a9d6f565e Refactor to avoid use of Hashtable. No functional change. 9a9d6f565e is described below commit 9a9d6f565e13d4c8a6ef2a35b30ef189da49a01a 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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new f80f42e21c Refactor to avoid use of Hashtable. No functional change. f80f42e21c is described below commit f80f42e21c1da2668336008507314e1770d5047e 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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new eceb2a2eb6 Refactor to avoid use of Hashtable. No functional change. eceb2a2eb6 is described below commit eceb2a2eb63ac3e71d9d5408b0b09295d55898ea 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 2561aaafc4..b359933bf3 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; @@ -894,9 +892,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; @@ -934,8 +932,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<>(); } @@ -2008,7 +2006,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++) { @@ -2053,9 +2051,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)); } @@ -2337,10 +2333,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 = @@ -4012,9 +4007,9 @@ class Generator { */ private static class TagHandlerInfo { -private Hashtable methodMaps; +private Map methodMaps; -private Hashtable> propertyEditorMaps; +private Map> propertyEditorMaps; private Class tagHandlerClass; @@ -4032,8 +4027,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 b4d62dcb37..96417c00f4 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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 393eafc920 Refactor to avoid use of Hashtable. No functional change. 393eafc920 is described below commit 393eafc920e251112e85140f8135192576b790b2 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 4be21fc5f2..dfad2ad907 100644 --- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java +++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java @@ -26,10 +26,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; @@ -104,7 +104,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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 1cd626daed Refactor to avoid use of Hashtable. No functional change. 1cd626daed is described below commit 1cd626daedc5358e573e604214c65e896cd5d1be 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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 0f673b7801 Refactor to avoid use of Hashtable. No functional change. 0f673b7801 is described below commit 0f673b7801d2d669993a48db50f2d6cb58af4652 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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new faeeedc08b Refactor to avoid use of Hashtable. No functional change. faeeedc08b is described below commit faeeedc08bd13f17aaa8cdbdfce302f1a463aa09 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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new f877a9dc96 Refactor to avoid use of Hashtable. No functional change. f877a9dc96 is described below commit f877a9dc96d3020a245f917b57adfa5fedcaf210 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 3bf4c069bb..27ea4a7120 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<>(); /** @@ -1571,7 +1570,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 8.5.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 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 8ab37d8c0d Refactor to avoid use of Hashtable. No functional change. 8ab37d8c0d is described below commit 8ab37d8c0dfb5609d4e6b68755c8c21f06bebb0b 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