Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
Following 1c35c6d the session to client
map is no longer used. Remove it.
Patch submitted by Brian Matzon.
  • Loading branch information
rmaucher committed Jan 17, 2025
1 parent 3291f64 commit 908fba1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -246,7 +245,6 @@ public void invoke(Request request, Response response) throws IOException, Servl
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private void verifyCrawlingContext(CrawlerSessionManagerValve valve, String cont
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();
Expand Down
5 changes: 5 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,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">
Expand Down

0 comments on commit 908fba1

Please sign in to comment.