mirror of https://github.com/apache/kafka.git
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 <mumrah@gmail.com>
This commit is contained in:
parent
d63d702252
commit
b25974c387
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue