From ec7bd2a2b75ecdf59222adc19c2398e1f0f40e3b Mon Sep 17 00:00:00 2001 From: Kai Wang Date: Sun, 23 Jul 2023 12:56:04 +0800 Subject: [PATCH] [improve][broker] Avoid print redirect exception log when get list from bundle (#20846) --- .../broker/admin/v2/NonPersistentTopics.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java index 372bb0162527e..2274b8a645843 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java @@ -463,25 +463,20 @@ public void getListFromBundle( } asyncResponse.resume(topicList); }).exceptionally(ex -> { - Throwable realCause = FutureUtil.unwrapCompletionException(ex); - log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(), - namespaceName, bundleRange, realCause); - if (realCause instanceof WebApplicationException) { - asyncResponse.resume(realCause); - } else { - asyncResponse.resume(new RestException(realCause)); + if (!isRedirectException(ex)) { + log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(), + namespaceName, bundleRange, ex); } + resumeAsyncResponseExceptionally(asyncResponse, ex); return null; }); } }).exceptionally(ex -> { - log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(), - namespaceName, bundleRange, ex); - if (ex.getCause() instanceof WebApplicationException) { - asyncResponse.resume(ex.getCause()); - } else { - asyncResponse.resume(new RestException(ex.getCause())); + if (!isRedirectException(ex)) { + log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(), + namespaceName, bundleRange, ex); } + resumeAsyncResponseExceptionally(asyncResponse, ex); return null; }); }