Skip to content

Commit d910091

Browse files
committed
Refine onError handling WebAsyncManager
In addition to the wrapping of errors recognized as client disconnected errors with AsyncRequestNotUsableException, we now wrap any IOException in the onError callback. The Servlet container would only be aware of such an exception if it relates to the response. Closes gh-33832
1 parent 21604d1 commit d910091

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.web.context.request.async;
1818

19+
import java.io.IOException;
1920
import java.util.ArrayList;
2021
import java.util.LinkedHashMap;
2122
import java.util.List;
@@ -34,7 +35,6 @@
3435
import org.springframework.util.Assert;
3536
import org.springframework.web.context.request.RequestAttributes;
3637
import org.springframework.web.context.request.async.DeferredResult.DeferredResultHandler;
37-
import org.springframework.web.util.DisconnectedClientHelper;
3838

3939
/**
4040
* The central class for managing asynchronous request processing, mainly intended
@@ -343,7 +343,7 @@ public void startCallableProcessing(final WebAsyncTask<?> webAsyncTask, Object..
343343
if (logger.isDebugEnabled()) {
344344
logger.debug("Servlet container error notification for " + formatUri(this.asyncWebRequest) + ": " + ex);
345345
}
346-
if (DisconnectedClientHelper.isClientDisconnectedException(ex)) {
346+
if (ex instanceof IOException) {
347347
ex = new AsyncRequestNotUsableException(
348348
"Servlet container error notification for disconnected client", ex);
349349
}
@@ -439,7 +439,7 @@ public void startDeferredResultProcessing(
439439
if (logger.isDebugEnabled()) {
440440
logger.debug("Servlet container error notification for " + formatUri(this.asyncWebRequest));
441441
}
442-
if (DisconnectedClientHelper.isClientDisconnectedException(ex)) {
442+
if (ex instanceof IOException) {
443443
ex = new AsyncRequestNotUsableException(
444444
"Servlet container error notification for disconnected client", ex);
445445
}

0 commit comments

Comments
 (0)