RobertIndie opened a new pull request #12961:
URL: https://github.com/apache/pulsar/pull/12961
### Motivation
The NPE may appear in `PersistentTopic.checkSubscriptionTypesEnable`. The
`topicPolicies.getSubscriptionTypesEnabled()` may be null.
Here is the stacktrace:
```
Caused by: java.lang.NullPointerException
at
org.apache.pulsar.broker.service.persistent.PersistentTopic.checkSubscriptionTypesEnable(PersistentTopic.java:3206)
~[io.streamnative-pulsar-broker-2.8.1.21.jar:2.8.1.21]
at
org.apache.pulsar.broker.service.persistent.PersistentTopic.subscribe(PersistentTopic.java:688)
~[io.streamnative-pulsar-broker-2.8.1.21.jar:2.8.1.21]
at
org.apache.pulsar.broker.service.ServerCnx.lambda$null$13(ServerCnx.java:1029)
~[io.streamnative-pulsar-broker-2.8.1.21.jar:2.8.1.21]
at
java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
~[?:?]
... 31 more
```
### Modifications
* Use `CollectionUtils.isEmpty` to determine if the list is empty to fix the
problem of throwing NPE.
### Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
### Documentation
- [x] `no-need-doc`
This is just a small bug fix.
--
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]