From 9a2d6ee68351295c6a673e35957d7db69c01738d Mon Sep 17 00:00:00 2001 From: fengyubiao Date: Tue, 5 Nov 2024 16:36:27 +0800 Subject: [PATCH] [fix] [admin] Fix lookup get a null result if uses proxy (#23556) (cherry picked from commit c53a85ec909d0b760fbcdd945bee6b6929922b63) (cherry picked from commit 2b98d2d17bcb6f2f4b94b149b9bc028b52ec6d5a) --- .../org/apache/pulsar/client/admin/internal/LookupImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ff7a02ca3275ef..2482f2cc7a5218 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