From fc19fce4678e67ea223069340e4b2a84f7555da4 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 5 Jul 2016 16:27:31 -0400 Subject: [PATCH] Log listener Throwables in default promise Motivation: The logging statements in i.n.u.c.DefaultPromise do not emit the caught Throwable when a Throwable is thrown while a listener is being notified of completed or progressed operations. Modifications: This issue arises because the logging message has a single placeholder but is passing two additional arguments, the second one being the caught Throwable that is thus quietly not logged. We address this by modifying the logging statements to ensure the caught Throwable is logged. In this case, the preferred approach is to use the logger override that accepts a message and a Throwable parameter since logger implementations might have special handling for this case. Result: Log messages from i.n.u.c.DefaultPromise when a Throwable is thrown while notifying a listener of completed or progressed operations will contain the caught Throwable. --- .../main/java/io/netty/util/concurrent/DefaultPromise.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java b/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java index d8d05a7b63..715395e7eb 100644 --- a/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java +++ b/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java @@ -520,7 +520,7 @@ public class DefaultPromise extends AbstractFuture implements Promise { try { l.operationComplete(future); } catch (Throwable t) { - logger.warn("An exception was thrown by {}.operationComplete()", l.getClass().getName(), t); + logger.warn("An exception was thrown by " + l.getClass().getName() + ".operationComplete()", t); } } @@ -747,7 +747,7 @@ public class DefaultPromise extends AbstractFuture implements Promise { try { l.operationProgressed(future, progress, total); } catch (Throwable t) { - logger.warn("An exception was thrown by {}.operationProgressed()", l.getClass().getName(), t); + logger.warn("An exception was thrown by " + l.getClass().getName() + ".operationProgressed()", t); } }