Browse Source

Merge branch '5.1.x'

pull/22621/head
Rossen Stoyanchev 7 years ago
parent
commit
2e7f98d7f6
  1. 21
      spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java

21
spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java

@ -69,17 +69,9 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
private static final String DISCONNECTED_CLIENT_LOG_CATEGORY = private static final String DISCONNECTED_CLIENT_LOG_CATEGORY =
"org.springframework.web.server.DisconnectedClient"; "org.springframework.web.server.DisconnectedClient";
/** // Similar declaration exists in AbstractSockJsSession..
* Tomcat: ClientAbortException or EOFException private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS = new HashSet<>(
* Jetty: EofException Arrays.asList("AbortedException", "ClientAbortException", "EOFException", "EofException"));
* WildFly, GlassFish: java.io.IOException "Broken pipe" (already covered)
* <p>TODO:
* This definition is currently duplicated between HttpWebHandlerAdapter
* and AbstractSockJsSession. It is a candidate for a common utility class.
* @see #isDisconnectedClientError(Throwable)
*/
private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS =
new HashSet<>(Arrays.asList("ClientAbortException", "EOFException", "EofException"));
private static final Log logger = LogFactory.getLog(HttpWebHandlerAdapter.class); private static final Log logger = LogFactory.getLog(HttpWebHandlerAdapter.class);
@ -299,8 +291,11 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
private boolean isDisconnectedClientError(Throwable ex) { private boolean isDisconnectedClientError(Throwable ex) {
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage(); String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage();
if (message != null && message.toLowerCase().contains("broken pipe")) { if (message != null) {
return true; String text = message.toLowerCase();
if (text.contains("broken pipe") || text.contains("connection reset by peer")) {
return true;
}
} }
return DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName()); return DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName());
} }

Loading…
Cancel
Save