Exclude DataAccessException and MessagingException in DisconnectedClientHelper

Closes gh-36134
This commit is contained in:
rstoyanchev
2026-01-14 11:44:43 +00:00
parent a784eb0ab4
commit 9f19b4074d
3 changed files with 22 additions and 14 deletions
@@ -28,7 +28,9 @@ import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import reactor.netty.channel.AbortedException;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.messaging.MessagingException;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.context.request.async.AsyncRequestNotUsableException;
import org.springframework.web.testfixture.http.MockHttpInputMessage;
@@ -78,16 +80,18 @@ public class DisconnectedClientHelperTests {
assertThat(DisconnectedClientHelper.isClientDisconnectedException(ex)).isTrue();
}
@Test // gh-34264
void onwardClientDisconnectedExceptionPhrase() {
Exception ex = new ResourceAccessException("I/O error", new EOFException("Connection reset by peer"));
@ParameterizedTest // gh-34264
@MethodSource("excludedExceptionsTypes")
void excludedExceptionTypes(Exception ex) {
assertThat(DisconnectedClientHelper.isClientDisconnectedException(ex)).isFalse();
}
@Test
void onwardClientDisconnectedExceptionType() {
Exception ex = new ResourceAccessException("I/O error", new EOFException());
assertThat(DisconnectedClientHelper.isClientDisconnectedException(ex)).isFalse();
static List<Exception> excludedExceptionsTypes() {
EOFException cause = new EOFException();
return List.of(
new ResourceAccessException("", cause),
new DataAccessResourceFailureException("", new EOFException()),
new MessagingException("", cause));
}
@Test // gh-34533