You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2018/11/15 10:49:46 UTC
[myfaces] branch 2.2.x updated: MYFACES-3736 Skip logging the
stacktrace when resource loading fails with ClientAbortExpcetion
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/2.2.x by this push:
new d609c00 MYFACES-3736 Skip logging the stacktrace when resource loading fails with ClientAbortExpcetion
d609c00 is described below
commit d609c00df4e1c5ea01146257fb43ccb52657a8ff
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Thu Nov 15 11:49:41 2018 +0100
MYFACES-3736 Skip logging the stacktrace when resource loading fails with ClientAbortExpcetion
---
.../myfaces/application/ResourceHandlerImpl.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 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 8358d2b..a556f28 100644
--- a/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
@@ -628,13 +628,21 @@ public class ResourceHandlerImpl extends ResourceHandler
catch (IOException e)
{
//TODO: Log using a localized message (which one?)
- if (log.isLoggable(Level.SEVERE))
+ if (isConnectionAbort(e))
{
- log.log(Level.SEVERE,"Error trying to load resource " + resourceName
- + " with library " + libraryName + " :"
- + e.getMessage(), e);
+ log.log(Level.INFO,"Connection was aborted while loading resource " + resourceName
+ + " with library " + libraryName);
+ }
+ else
+ {
+ if (log.isLoggable(Level.WARNING))
+ {
+ log.log(Level.WARNING,"Error trying to load and send resource " + resourceName
+ + " with library " + libraryName + " :"
+ + e.getMessage(), e);
+ }
+ httpServletResponse.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
- httpServletResponse.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
//}
//catch (Throwable ex)
@@ -646,6 +654,11 @@ public class ResourceHandlerImpl extends ResourceHandler
//}
}
+ private static boolean isConnectionAbort(IOException e)
+ {
+ return e.getClass().getCanonicalName().equals("org.apache.catalina.connector.ClientAbortException");
+ }
+
/**
* Reads the specified input stream into the provided byte array storage and
* writes it to the output stream.