Polish gh-1798

- Should throw IllegalStateException
This commit is contained in:
Eleftheria Stein
2021-03-25 09:55:32 +02:00
parent 8bd4374909
commit d2960b570f
2 changed files with 3 additions and 2 deletions

View File

@@ -312,7 +312,7 @@ public class SessionRepositoryFilter<S extends Session> extends OncePerRequestFi
}
if (SessionRepositoryFilter.this.httpSessionIdResolver instanceof CookieHttpSessionIdResolver
&& this.response.isCommitted()) {
throw new IllegalArgumentException("Cannot create a session after the response has been committed");
throw new IllegalStateException("Cannot create a session after the response has been committed");
}
if (SESSION_LOGGER.isDebugEnabled()) {
SESSION_LOGGER.debug(

View File

@@ -62,6 +62,7 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
@@ -425,7 +426,7 @@ class SessionRepositoryFilterTests {
@Test
void doFilterGetSessionNewWhenResponseCommittedThenException() {
assertThatIllegalArgumentException().isThrownBy(() -> doFilter(new DoInFilter() {
assertThatIllegalStateException().isThrownBy(() -> doFilter(new DoInFilter() {
@Override
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
throws IOException {