diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java index ff7a02ca3275e..2482f2cc7a521 100644 --- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java +++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java @@ -24,6 +24,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import javax.ws.rs.client.WebTarget; +import org.apache.commons.lang3.StringUtils; import org.apache.pulsar.client.admin.Lookup; import org.apache.pulsar.client.admin.PulsarAdminException; import org.apache.pulsar.client.admin.Topics; @@ -57,7 +58,8 @@ public CompletableFuture lookupTopicAsync(String topic) { WebTarget path = v2lookup.path(prefix).path(topicName.getLookupName()); return asyncGetRequest(path, new FutureCallback() {}) - .thenApply(lookupData -> useTls ? lookupData.getBrokerUrlTls() : lookupData.getBrokerUrl()); + .thenApply(lookupData -> useTls && StringUtils.isNotBlank(lookupData.getBrokerUrlTls()) + ? lookupData.getBrokerUrlTls() : lookupData.getBrokerUrl()); } @Override