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

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

commit 8de9619987b1130353eb6390c7307cd8cfc91921
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 7bcb863111..f6ce1b09cf 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 9c535ca416..1042e4287a 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 a7cf488edc..e992e700e0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -167,6 +167,11 @@
         Improve checks for <code>WEB-INF</code> and <code>META-INF</code> in
         the WebDAV servlet. Based on a patch submitted by Chenjp. (remm)
       </fix>
+      <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