Add missing exception name to DisconnectedClientHelper
Closes gh-31717
This commit is contained in:
parent
9ade52dbe2
commit
8ca82120e0
|
@ -39,8 +39,7 @@ public class DisconnectedClientHelper {
|
|||
Set.of("broken pipe", "connection reset by peer");
|
||||
|
||||
private static final Set<String> EXCEPTION_TYPE_NAMES =
|
||||
Set.of("ClientAbortException", "EOFException", "EofException");
|
||||
|
||||
Set.of("AbortedException", "ClientAbortException", "EOFException", "EofException");
|
||||
|
||||
private final Log logger;
|
||||
|
||||
|
@ -51,28 +50,6 @@ public class DisconnectedClientHelper {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Whether the given exception indicates the client has gone away.
|
||||
* Known cases covered:
|
||||
* <ul>
|
||||
* <li>ClientAbortException or EOFException for Tomcat
|
||||
* <li>EofException for Jetty
|
||||
* <li>IOException "Broken pipe" or "connection reset by peer"
|
||||
* </ul>
|
||||
*/
|
||||
public boolean isClientDisconnectedException(Throwable ex) {
|
||||
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage();
|
||||
if (message != null) {
|
||||
String text = message.toLowerCase();
|
||||
for (String phrase : EXCEPTION_PHRASES) {
|
||||
if (text.contains(phrase)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return EXCEPTION_TYPE_NAMES.contains(ex.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check via {@link #isClientDisconnectedException} if the exception
|
||||
* indicates the remote client disconnected, and if so log a single line
|
||||
|
@ -93,4 +70,26 @@ public class DisconnectedClientHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given exception indicates the client has gone away.
|
||||
* Known cases covered:
|
||||
* <ul>
|
||||
* <li>ClientAbortException or EOFException for Tomcat
|
||||
* <li>EofException for Jetty
|
||||
* <li>IOException "Broken pipe" or "connection reset by peer"
|
||||
* </ul>
|
||||
*/
|
||||
public static boolean isClientDisconnectedException(Throwable ex) {
|
||||
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage();
|
||||
if (message != null) {
|
||||
String text = message.toLowerCase();
|
||||
for (String phrase : EXCEPTION_PHRASES) {
|
||||
if (text.contains(phrase)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return EXCEPTION_TYPE_NAMES.contains(ex.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue