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

commit fc0aa20c16f44ee7e944cb3352f90f71e6aa2cd2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri May 3 14:55:32 2024 +0100

    ManagerBase dropped the duplicate session ID check. Drop it here too.
---
 java/org/apache/catalina/Manager.java | 16 +---------------
 webapps/docs/changelog.xml            |  7 ++++++-
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/Manager.java 
b/java/org/apache/catalina/Manager.java
index ed52490b33..4053efd62c 100644
--- a/java/org/apache/catalina/Manager.java
+++ b/java/org/apache/catalina/Manager.java
@@ -213,21 +213,7 @@ public interface Manager {
      * @return  The new session ID
      */
     default String rotateSessionId(Session session) {
-        String newSessionId = null;
-        // Assume the new Id is a duplicate until we prove it isn't. The
-        // chances of a duplicate are extremely low but the current ManagerBase
-        // code protects against duplicates so this default method does too.
-        boolean duplicate = true;
-        do {
-            newSessionId = getSessionIdGenerator().generateSessionId();
-            try {
-                if (findSession(newSessionId) == null) {
-                    duplicate = false;
-                }
-            } catch (IOException ioe) {
-                // Swallow. An IOE means the ID was known so continue looping
-            }
-        } while (duplicate);
+        String newSessionId = getSessionIdGenerator().generateSessionId();
         changeSessionId(session, newSessionId);
         return newSessionId;
     }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 472c2ff1d1..e764aed747 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -150,12 +150,17 @@
         Add periodic checking for WebDAV locks expiration. (remm)
       </fix>
       <fix>
-        Extend <code>Asn1Parser</code> to parse <code>UTF8String</code>s. 
(michaelo)
+        Extend <code>Asn1Parser</code> to parse <code>UTF8String</code>s.
+        (michaelo)
       </fix>
       <fix>
         Remove MBean metadata for attibutes that have been removed. Based on
         <pr>719</pr> by Shawn Q. (markt)
       </fix>
+      <scode>
+        Remove duplicate ID check from <code>Manager.rotateSessionId()</code>.
+        (markt)
+      </scode>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to