Adapt to changes in Framework's internals

See gh-37995
This commit is contained in:
Andy Wilkinson 2023-10-23 18:07:38 +01:00
parent 959311bf0e
commit a9469d9c8e
2 changed files with 3 additions and 5 deletions

View File

@ -62,13 +62,12 @@ import org.springframework.web.util.HtmlUtils;
public abstract class AbstractErrorWebExceptionHandler implements ErrorWebExceptionHandler, InitializingBean {
/**
* Currently duplicated from Spring WebFlux HttpWebHandlerAdapter.
* Currently duplicated from Spring Web's DisconnectedClientHelper.
*/
private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS;
static {
Set<String> exceptions = new HashSet<>();
exceptions.add("AbortedException");
exceptions.add("ClientAbortException");
exceptions.add("EOFException");
exceptions.add("EofException");

View File

@ -38,7 +38,7 @@ import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.result.view.View;
import org.springframework.web.reactive.result.view.ViewResolver;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.HttpWebHandlerAdapter;
import org.springframework.web.util.DisconnectedClientHelper;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@ -58,8 +58,7 @@ class DefaultErrorWebExceptionHandlerTests {
void disconnectedClientExceptionsMatchesFramework() {
Object errorHandlers = ReflectionTestUtils.getField(AbstractErrorWebExceptionHandler.class,
"DISCONNECTED_CLIENT_EXCEPTIONS");
Object webHandlers = ReflectionTestUtils.getField(HttpWebHandlerAdapter.class,
"DISCONNECTED_CLIENT_EXCEPTIONS");
Object webHandlers = ReflectionTestUtils.getField(DisconnectedClientHelper.class, "EXCEPTION_TYPE_NAMES");
assertThat(errorHandlers).isNotNull().isEqualTo(webHandlers);
}