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:53:19 UTC

[myfaces] branch 2.3.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.3.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/2.3.x by this push:
     new 68c8ab6  MYFACES-3736 Skip logging the stacktrace when resource loading fails with ClientAbortExpcetion
68c8ab6 is described below

commit 68c8ab6fc22c49d3e82ea890ea5d70f2950944a0
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Thu Nov 15 11:53:14 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 6fe6721..a4a170e 100644
--- a/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
@@ -657,13 +657,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)
@@ -675,6 +683,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.