git-enzo opened a new issue #7543:
URL: https://github.com/apache/pulsar/issues/7543


   **Describe the bug**
   
   The MultiTopicsConsumerImpl class contains two methods named 
```subscribeAsync()``` which return ```CompletableFuture<Void>``` as a result.
   The first step in both methods is checking if given topic name is valid 
using ```topicNameValid()``` method as follow:
   
   ```
   if (!topicNameValid(topicName)) {
       return FutureUtil.failedFuture(
           new PulsarClientException.AlreadyClosedException("Topic name not 
valid"));
   }
   ```
   
   The problem is that ```topicNameValid()``` method always returns true or 
throws an exception. It never returns false, so code inside "if" block is 
unreachable.
   
   ```
      private boolean topicNameValid(String topicName) {
           checkArgument(TopicName.isValid(topicName), "Invalid topic name:" + 
topicName); // throws Exception
           checkArgument(!topics.containsKey(topicName), "Topics already 
contains topic:" + topicName); // throws Exception
   
           return true;
       }
   ```
   
   **Expected behavior**
   Method ```topicNameValid()``` should return false if topic validation failed.
   
   


----------------------------------------------------------------
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.

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


Reply via email to