This is an automated email from the ASF dual-hosted git repository. penghui pushed a commit to branch branch-2.8 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 23b482327b81c952c2f12e1a67f791c588001e67 Author: Michael Marshall <[email protected]> AuthorDate: Mon Nov 22 04:45:52 2021 -0500 [Java Client] Avoid IllegalStateException in ClientCnx debug logs (#12899) (cherry picked from commit 32b697d3adb18ecc9992f6dfbf9ac13158649af3) --- .../src/main/java/org/apache/pulsar/client/impl/ClientCnx.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java index 3820497..8c22f66 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java @@ -530,7 +530,9 @@ public class ClientCnx extends PulsarHandler { @Override protected void handleLookupResponse(CommandLookupTopicResponse lookupResult) { if (log.isDebugEnabled()) { - log.debug("Received Broker lookup response: {}", lookupResult.getResponse()); + CommandLookupTopicResponse.LookupType response = + lookupResult.hasResponse() ? lookupResult.getResponse() : null; + log.debug("Received Broker lookup response: {} {}", lookupResult.getRequestId(), response); } long requestId = lookupResult.getRequestId(); @@ -565,7 +567,11 @@ public class ClientCnx extends PulsarHandler { @Override protected void handlePartitionResponse(CommandPartitionedTopicMetadataResponse lookupResult) { if (log.isDebugEnabled()) { - log.debug("Received Broker Partition response: {}", lookupResult.getPartitions()); + CommandPartitionedTopicMetadataResponse.LookupType response = + lookupResult.hasResponse() ? lookupResult.getResponse() : null; + int partitions = lookupResult.hasPartitions() ? lookupResult.getPartitions() : -1; + log.debug("Received Broker Partition response: {} {} {}", lookupResult.getRequestId(), response, + partitions); } long requestId = lookupResult.getRequestId();
