Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6277 - Protect from Throwables on HttpSessionListener events. #6948

Merged
merged 1 commit into from Oct 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -18,8 +18,6 @@

package org.eclipse.jetty.server.session;

import static java.lang.Math.round;

import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
Expand All @@ -28,7 +26,6 @@
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;

import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -53,6 +50,8 @@
import org.eclipse.jetty.util.statistic.CounterStatistic;
import org.eclipse.jetty.util.statistic.SampleStatistic;

import static java.lang.Math.round;

/**
* An Abstract implementation of SessionManager.
* <p>
Expand Down Expand Up @@ -703,7 +702,16 @@ protected void addSession(AbstractSession session, boolean created)
{
HttpSessionEvent event=new HttpSessionEvent(session);
for (HttpSessionListener listener : _sessionListeners)
listener.sessionCreated(event);
{
try
{
listener.sessionCreated(event);
}
catch (Throwable t)
{
__log.warn("Error during Session created listener", t);
}
}
}
}
}
Expand Down Expand Up @@ -791,7 +799,14 @@ public boolean removeSession(AbstractSession session, boolean invalidate)
HttpSessionEvent event=new HttpSessionEvent(session);
for (int i = _sessionListeners.size()-1; i>=0; i--)
{
_sessionListeners.get(i).sessionDestroyed(event);
try
{
_sessionListeners.get(i).sessionDestroyed(event);
}
catch(Throwable t)
{
__log.warn("Error during Session destroy listener", t);
}
}
}
}
Expand Down