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

remm 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 e0604e350b Remove unused code
e0604e350b is described below

commit e0604e350b515215c901fa9cf279e3c311876639
Author: remm <r...@apache.org>
AuthorDate: Fri Jan 17 10:41:19 2025 +0100

    Remove unused code
    
    Following 1c35c6dbd5f158f62a63c428f09537c876bd3735 the session to client
    map is no longer used. Remove it.
    Patch submitted by Brian Matzon.
---
 java/org/apache/catalina/valves/CrawlerSessionManagerValve.java     | 2 --
 test/org/apache/catalina/valves/TestCrawlerSessionManagerValve.java | 2 +-
 webapps/docs/changelog.xml                                          | 5 +++++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java 
b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
index b21d8b083f..3492cd15e7 100644
--- a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
+++ b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
@@ -46,7 +46,6 @@ public class CrawlerSessionManagerValve extends ValveBase {
     private static final Log log = 
LogFactory.getLog(CrawlerSessionManagerValve.class);
 
     private final Map<String,String> clientIdSessionId = new 
ConcurrentHashMap<>();
-    private final Map<String,String> sessionIdClientId = new 
ConcurrentHashMap<>();
 
     private String crawlerUserAgents = ".*[bB]ot.*|.*Yahoo! 
Slurp.*|.*Feedfetcher-Google.*";
     private Pattern uaPattern = null;
@@ -246,7 +245,6 @@ public class CrawlerSessionManagerValve extends ValveBase {
                 HttpSession s = request.getSession(false);
                 if (s != null) {
                     clientIdSessionId.put(clientIdentifier, s.getId());
-                    sessionIdClientId.put(s.getId(), clientIdentifier);
                     // #valueUnbound() will be called on session expiration
                     s.setAttribute(this.getClass().getName(),
                             new 
CrawlerHttpSessionBindingListener(clientIdSessionId, clientIdentifier));
diff --git 
a/test/org/apache/catalina/valves/TestCrawlerSessionManagerValve.java 
b/test/org/apache/catalina/valves/TestCrawlerSessionManagerValve.java
index 2f48f7bf4e..bce456e0c1 100644
--- a/test/org/apache/catalina/valves/TestCrawlerSessionManagerValve.java
+++ b/test/org/apache/catalina/valves/TestCrawlerSessionManagerValve.java
@@ -165,7 +165,7 @@ public class TestCrawlerSessionManagerValve {
     private HttpSession createSessionExpectations(CrawlerSessionManagerValve 
valve, boolean isBot) {
         HttpSession session = EasyMock.createMock(HttpSession.class);
         if (isBot) {
-            EasyMock.expect(session.getId()).andReturn("id").times(2);
+            EasyMock.expect(session.getId()).andReturn("id").times(1);
             session.setAttribute(EasyMock.eq(valve.getClass().getName()),
                     EasyMock.anyObject(HttpSessionBindingListener.class));
             EasyMock.expectLastCall();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e23927cc29..12397928bf 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -149,6 +149,11 @@
         be confirmed that the JVM has been correctly configured, prevent the
         impacted web applications from starting. (markt)
       </add>
+      <fix>
+        Remove unused session to client map from
+        <code>CrawlerSessionManagerValve</code>. Submitted by Brian Matzon.
+        (remm)
+      </fix>
     </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