You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/09/12 17:59:55 UTC

[tomcat] branch 8.5.x updated: ByteBufferUtils.cleanDirectBuffer invocation failures are logged

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new a8233ca  ByteBufferUtils.cleanDirectBuffer invocation failures are logged
a8233ca is described below

commit a8233ca8f16663cea1a4f09d4fd90166ac480f12
Author: Carter Kozak <ck...@ckozak.net>
AuthorDate: Wed Sep 11 15:45:24 2019 -0700

    ByteBufferUtils.cleanDirectBuffer invocation failures are logged
    
    Previously cleanMethod failures were ignored entirely, and
    invokeCleanerMethod failures were logged to stderr using
    Throwable.printStackTrace().
    Now debug logging may be enabled to capture this information
    using the configured logging framework.
---
 java/org/apache/tomcat/util/buf/ByteBufferUtils.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/buf/ByteBufferUtils.java b/java/org/apache/tomcat/util/buf/ByteBufferUtils.java
index 8365d22..0937230 100644
--- a/java/org/apache/tomcat/util/buf/ByteBufferUtils.java
+++ b/java/org/apache/tomcat/util/buf/ByteBufferUtils.java
@@ -125,15 +125,18 @@ public class ByteBufferUtils {
                 cleanMethod.invoke(cleanerMethod.invoke(buf));
             } catch (IllegalAccessException | IllegalArgumentException
                     | InvocationTargetException | SecurityException e) {
-                // Ignore
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("byteBufferUtils.cleaner"), e);
+                }
             }
         } else if (invokeCleanerMethod != null) {
             try {
                 invokeCleanerMethod.invoke(unsafe, buf);
             } catch (IllegalAccessException | IllegalArgumentException
                     | InvocationTargetException | SecurityException e) {
-                // Ignore
-                e.printStackTrace();
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("byteBufferUtils.cleaner"), e);
+                }
             }
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org