From cee77c17dc3fed5f53498eb6ec3be308dac84412 Mon Sep 17 00:00:00 2001 From: melloware Date: Thu, 5 Dec 2024 07:59:58 -0500 Subject: [PATCH] MYFACES-4696: 5.0 Undertow connection abort handling --- .../myfaces/application/ResourceHandlerImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java b/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java index 2463d5abe..a72d13e79 100644 --- a/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java +++ b/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java @@ -612,7 +612,7 @@ libraryName, isAllowSlashesLibraryName())) } } } - catch (IOException e) + catch (Exception e) { if (isConnectionAbort(e)) { @@ -635,10 +635,12 @@ libraryName, isAllowSlashesLibraryName())) } } - private static boolean isConnectionAbort(IOException e) + private static boolean isConnectionAbort(Exception e) { - return e.getClass().getCanonicalName().equals("org.apache.catalina.connector.ClientAbortException") - || e.getClass().getCanonicalName().equals("org.eclipse.jetty.io.EofException"); + String exceptionName = e.getClass().getCanonicalName(); + return "org.apache.catalina.connector.ClientAbortException".equals(exceptionName) // Tomcat + || "org.eclipse.jetty.io.EofException".equals(exceptionName) // Jetty + || (e instanceof IllegalStateException && e.getMessage().contains("UT000127")); // Undertow } /**