You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/05/14 12:29:38 UTC

[GitHub] [kafka] zhaohaidao commented on a change in pull request #8665: KAFKA-9984 Should fail the subscription when pattern is empty

zhaohaidao commented on a change in pull request #8665:
URL: https://github.com/apache/kafka/pull/8665#discussion_r425097747



##########
File path: clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
##########
@@ -1015,8 +1015,8 @@ public void subscribe(Collection<String> topics) {
     @Override
     public void subscribe(Pattern pattern, ConsumerRebalanceListener listener) {
         maybeThrowInvalidGroupIdException();
-        if (pattern == null)
-            throw new IllegalArgumentException("Topic pattern to subscribe to cannot be null");
+        if (pattern == null || pattern.toString().equals(""))
+            throw new IllegalArgumentException("Topic pattern to subscribe to cannot be " + pattern == null ? "null" : "empty");

Review comment:
       Thanks. I have fixed this issue. Could you continue to review it.




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