Jason918 commented on a change in pull request #13805:
URL: https://github.com/apache/pulsar/pull/13805#discussion_r788318539



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
##########
@@ -866,23 +866,42 @@ public void validateTenantOperation(String tenant, 
TenantOperation operation) {
         }
     }
 
-    public void validateNamespaceOperation(NamespaceName namespaceName, 
NamespaceOperation operation) {
+    public void validateNamespaceOperation(NamespaceName namespaceName, 
NamespaceOperation operation){
+        try {
+            validateNamespaceOperationAsync(namespaceName, operation).get();
+        } catch (InterruptedException e) {
+            throw new RestException(e);
+        } catch (ExecutionException e) {
+            Throwable cause = e.getCause();
+            if (cause instanceof WebApplicationException){
+                throw (WebApplicationException) cause;
+            } else {
+                throw new RestException(cause);
+            }
+        }
+    }
+
+
+    public CompletableFuture<Void> 
validateNamespaceOperationAsync(NamespaceName namespaceName,
+                                                              
NamespaceOperation operation) {
         if (pulsar().getConfiguration().isAuthenticationEnabled()
             && pulsar().getBrokerService().isAuthorizationEnabled()) {
             if (!isClientAuthenticated(clientAppId())) {
                 throw new RestException(Status.FORBIDDEN, "Need to 
authenticate to perform the request");

Review comment:
       The exception won't be handled by `exceptionally` outside. No 
`CompletableFuture` is returned.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to