You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ma...@apache.org on 2022/07/25 13:13:36 UTC

[pulsar] branch branch-2.9 updated: Fix branch-2.9 compatible issue. (#16779)

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

mattisonchao pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.9 by this push:
     new ca643cafc12 Fix branch-2.9 compatible issue. (#16779)
ca643cafc12 is described below

commit ca643cafc12650f914c647480314b9630cf94fbc
Author: Qiang Zhao <ma...@gmail.com>
AuthorDate: Mon Jul 25 21:13:26 2022 +0800

    Fix branch-2.9 compatible issue. (#16779)
---
 .../org/apache/pulsar/broker/admin/AdminResource.java     | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
index fef7abf6d07..415ab2f97d1 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
@@ -746,14 +746,15 @@ public abstract class AdminResource extends PulsarWebResource {
     }
 
     protected void resumeAsyncResponseExceptionally(AsyncResponse asyncResponse, Throwable throwable) {
-        if (throwable instanceof WebApplicationException) {
-            asyncResponse.resume(throwable);
-        } else if (throwable instanceof BrokerServiceException.NotAllowedException) {
-            asyncResponse.resume(new RestException(Status.CONFLICT, throwable));
-        } else if (throwable instanceof PulsarAdminException) {
-            asyncResponse.resume(new RestException(((PulsarAdminException) throwable)));
+        Throwable realCause = FutureUtil.unwrapCompletionException(throwable);
+        if (realCause instanceof WebApplicationException) {
+            asyncResponse.resume(realCause);
+        } else if (realCause instanceof BrokerServiceException.NotAllowedException) {
+            asyncResponse.resume(new RestException(Status.CONFLICT, realCause));
+        } else if (realCause instanceof PulsarAdminException) {
+            asyncResponse.resume(new RestException(((PulsarAdminException) realCause)));
         } else {
-            asyncResponse.resume(new RestException(throwable));
+            asyncResponse.resume(new RestException(realCause));
         }
     }