You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by cm...@apache.org on 2019/03/28 21:47:47 UTC
[kafka] branch trunk updated: MINOR: WorkerUtils#abort: fix bug in
abort logic (#6516)
This is an automated email from the ASF dual-hosted git repository.
cmccabe pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new b25974c MINOR: WorkerUtils#abort: fix bug in abort logic (#6516)
b25974c is described below
commit b25974c387571b77fbe1e5010dbdd3f40a60a61d
Author: Colin Patrick McCabe <co...@cmccabe.xyz>
AuthorDate: Thu Mar 28 14:47:37 2019 -0700
MINOR: WorkerUtils#abort: fix bug in abort logic (#6516)
doneFuture is supposed to be completed with an empty string (meaning success) or a non-empty string which is the error message. Currently, due to exception.getMessage sometimes returning null or an empty string, this is not working correctly. This patch fixes that.
Reviewers: David Arthur <mu...@gmail.com>
---
.../main/java/org/apache/kafka/trogdor/common/WorkerUtils.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/src/main/java/org/apache/kafka/trogdor/common/WorkerUtils.java b/tools/src/main/java/org/apache/kafka/trogdor/common/WorkerUtils.java
index ef6e275..ad54c06 100644
--- a/tools/src/main/java/org/apache/kafka/trogdor/common/WorkerUtils.java
+++ b/tools/src/main/java/org/apache/kafka/trogdor/common/WorkerUtils.java
@@ -62,8 +62,12 @@ public final class WorkerUtils {
*/
public static void abort(Logger log, String what, Throwable exception,
KafkaFutureImpl<String> doneFuture) throws KafkaException {
- log.warn("{} caught an exception: ", what, exception);
- doneFuture.complete(exception.getMessage());
+ log.warn("{} caught an exception", what, exception);
+ if (exception.getMessage() == null || exception.getMessage().isEmpty()) {
+ doneFuture.complete(exception.getClass().getCanonicalName());
+ } else {
+ doneFuture.complete(exception.getMessage());
+ }
throw new KafkaException(exception);
}