You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/07/15 11:50:39 UTC

[GitHub] [pulsar] git-enzo opened a new issue #7543: Dead code in MultiTopicsConsumerImpl class - occurs if topic name validation failed during subscribing

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:
users@infra.apache.org



[GitHub] [pulsar] 315157973 commented on issue #7543: Dead code in MultiTopicsConsumerImpl class - occurs if topic name validation failed during subscribing

Posted by GitBox <gi...@apache.org>.
315157973 commented on issue #7543:
URL: https://github.com/apache/pulsar/issues/7543#issuecomment-660480279


   I'm free on the weekend, please assign it to me  :smile:


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on issue #7543: Dead code in MultiTopicsConsumerImpl class - occurs if topic name validation failed during subscribing

Posted by GitBox <gi...@apache.org>.
sijie commented on issue #7543:
URL: https://github.com/apache/pulsar/issues/7543#issuecomment-659776378


   @git-enzo Are you interested in contributing a 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org