This is an automated email from the ASF dual-hosted git repository. jinrongtong pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push: new dbd2791eca [ISSUE #8889] handle namespace outside the loop (#8890) dbd2791eca is described below commit dbd2791eca741de29bc8962c66a7744f0c3311a5 Author: mawen12 <118196301...@gmail.com> AuthorDate: Fri Nov 8 09:03:10 2024 +0800 [ISSUE #8889] handle namespace outside the loop (#8890) * handle namespace outside the loop * fix checkstyle check failed --- .../client/impl/consumer/DefaultLitePullConsumerImpl.java | 8 ++++---- .../rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java index f5ff3179bf..f85dcc7b45 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java @@ -1084,12 +1084,12 @@ public class DefaultLitePullConsumerImpl implements MQConsumerInner { } //If namespace not null , reset Topic without namespace. - for (MessageExt messageExt : msgList) { - if (null != this.defaultLitePullConsumer.getNamespace()) { - messageExt.setTopic(NamespaceUtil.withoutNamespace(messageExt.getTopic(), this.defaultLitePullConsumer.getNamespace())); + String namespace = this.defaultLitePullConsumer.getNamespace(); + if (namespace != null) { + for (MessageExt messageExt : msgList) { + messageExt.setTopic(NamespaceUtil.withoutNamespace(messageExt.getTopic(), namespace)); } } - } public void updateConsumeOffset(MessageQueue mq, long offset) { diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java index c877ccc070..9a8ea8fb4f 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java @@ -290,12 +290,12 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner { } //If namespace not null , reset Topic without namespace. - for (MessageExt messageExt : msgList) { - if (null != this.getDefaultMQPullConsumer().getNamespace()) { - messageExt.setTopic(NamespaceUtil.withoutNamespace(messageExt.getTopic(), this.defaultMQPullConsumer.getNamespace())); + String namespace = this.getDefaultMQPullConsumer().getNamespace(); + if (namespace != null) { + for (MessageExt messageExt : msgList) { + messageExt.setTopic(NamespaceUtil.withoutNamespace(messageExt.getTopic(), namespace)); } } - } public void subscriptionAutomatically(final String topic) {