You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2023/07/23 04:56:10 UTC

[pulsar] branch master updated: [improve][broker] Avoid print redirect exception log when get list from bundle (#20846)

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

technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 9256407cdca [improve][broker] Avoid print redirect exception log when get list from bundle (#20846)
9256407cdca is described below

commit 9256407cdca1ab6d9b3a59ce404dccb09953ab24
Author: Kai Wang <kw...@apache.org>
AuthorDate: Sun Jul 23 12:56:04 2023 +0800

    [improve][broker] Avoid print redirect exception log when get list from bundle (#20846)
---
 .../pulsar/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 36e88d91b3a..c360eeabb58 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
@@ -467,25 +467,20 @@ public class NonPersistentTopics extends PersistentTopics {
                             }
                             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;
         });
     }