From 356dc618e892795624f4b3f4428ebed09c049913 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Fri, 2 Jul 2021 19:04:54 +0200 Subject: [PATCH] Fixed using CommandSubscribe.getConsumerName() without checking --- .../main/java/org/apache/pulsar/broker/service/ServerCnx.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java index 13408bc645912..fed73ce75c95a 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java @@ -905,14 +905,14 @@ protected void handleSubscribe(final CommandSubscribe subscribe) { final String subscriptionName = subscribe.getSubscription(); final SubType subType = subscribe.getSubType(); - final String consumerName = subscribe.getConsumerName(); + final String consumerName = subscribe.hasConsumerName() ? subscribe.getConsumerName() : ""; final boolean isDurable = subscribe.isDurable(); final MessageIdImpl startMessageId = subscribe.hasStartMessageId() ? new BatchMessageIdImpl( subscribe.getStartMessageId().getLedgerId(), subscribe.getStartMessageId().getEntryId(), subscribe.getStartMessageId().getPartition(), subscribe.getStartMessageId().getBatchIndex()) : null; final int priorityLevel = subscribe.hasPriorityLevel() ? subscribe.getPriorityLevel() : 0; - final boolean readCompacted = subscribe.isReadCompacted(); + final boolean readCompacted = subscribe.hasReadCompacted() && subscribe.isReadCompacted(); final Map metadata = CommandUtils.metadataFromCommand(subscribe); final InitialPosition initialPosition = subscribe.getInitialPosition(); final long startMessageRollbackDurationSec = subscribe.hasStartMessageRollbackDurationSec()