You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by je...@apache.org on 2019/05/02 19:30:11 UTC

[pulsar] branch master updated: provide better error handling logic for when a tenant doesn't exist (#4188)

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

jerrypeng 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 0920e6a  provide better error handling logic for when a tenant doesn't exist (#4188)
0920e6a is described below

commit 0920e6ae03e26b343f14677cde1196cad88e5cb3
Author: Boyang Jerry Peng <je...@gmail.com>
AuthorDate: Thu May 2 12:30:04 2019 -0700

    provide better error handling logic for when a tenant doesn't exist (#4188)
---
 .../apache/pulsar/functions/worker/rest/api/ComponentImpl.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java
index 3ef5ec5..d343adb 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java
@@ -1694,9 +1694,13 @@ private FunctionDetails validateUpdateRequestParams(final String tenant,
             }
 
             if (clientRole != null) {
-                TenantInfo tenantInfo = worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
-                if (tenantInfo.getAdminRoles() != null && tenantInfo.getAdminRoles().contains(clientRole)) {
-                    return true;
+                try {
+                    TenantInfo tenantInfo = worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
+                    if (tenantInfo != null && tenantInfo.getAdminRoles() != null && tenantInfo.getAdminRoles().contains(clientRole)) {
+                        return true;
+                    }
+                } catch (PulsarAdminException.NotFoundException e) {
+
                 }
             }