RobertIndie commented on a change in pull request #12961:
URL: https://github.com/apache/pulsar/pull/12961#discussion_r756553084



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -3218,7 +3219,7 @@ public boolean checkSubscriptionTypesEnable(SubType 
subType) throws Exception {
                 if (topicPolicies == null) {
                     return checkNsAndBrokerSubscriptionTypesEnable(topicName, 
subType);
                 } else {
-                    if (topicPolicies.getSubscriptionTypesEnabled().isEmpty()) 
{
+                    if 
(CollectionUtils.isEmpty(topicPolicies.getSubscriptionTypesEnabled())) {

Review comment:
       The problem occurred when upgrading from pulsar version 2.7 to 2.8. I 
have added the root cause of the problem and the reproduce steps to the PR 
description. Please check. @yuruguo @gaozhangmin 
   
   > In addition, it is recommended to combine the two judgments as below:
   > ```
   > if (topicPolicies == null || 
CollectionUtils.isEmpty(topicPolicies.getSubscriptionTypesEnabled())) {
   >     return checkNsAndBrokerSubscriptionTypesEnable(topicName, subType);
   > } else {
   >     return topicPolicies.getSubscriptionTypesEnabled().contains(subType);
   > }
   > ```
   
   @yuruguo I don't think we need to. The null check of topicPolicy has been 
done before.
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to