{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/199029295","pull_request_review_id":133068893,"id":199029295,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTAyOTI5NQ==","diff_hunk":"@@ -609,4 +614,51 @@ public void testOnlyCanExecuteCloseAfterInitTransactionsTimeout() {\n             producer.close(0, TimeUnit.MILLISECONDS);\n         }\n     }\n+\n+    @Test\n+    public void testInvalidTopicName() throws Exception {\n+\n+        Properties props = new Properties();\n+        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, \"localhost:9000\");\n+        props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, \"15000\");\n+\n+        Time time = new MockTime();\n+        Cluster cluster = TestUtils.singletonCluster();\n+        Node node = cluster.nodes().get(0);\n+\n+        Metadata metadata = new Metadata(0, Long.MAX_VALUE, true);\n+        metadata.update(cluster, Collections.<String>emptySet(), time.milliseconds());\n+\n+        MockClient client = new MockClient(time, metadata);\n+        client.setNode(node);\n+\n+        Producer<String, String> producer = new KafkaProducer<>(new ProducerConfig(\n+            ProducerConfig.addSerializerToConfig(props, new StringSerializer(), new StringSerializer())),\n+            new StringSerializer(), new StringSerializer(), metadata, client);\n+\n+        String invalidTopicName = \"topic abc\";  // Invalid topic name due to space\n+        ProducerRecord<String, String> record = new ProducerRecord<>(invalidTopicName, \"HelloKafka\");\n+\n+        Set<String> invalidTopic = new HashSet<String>();\n+        invalidTopic.add(invalidTopicName);\n+        Cluster metaDataUpdateResponseCluster = new Cluster(cluster.clusterResource().clusterId(),\n+                                                            cluster.nodes(),\n+                                                            new ArrayList<PartitionInfo>(0),\n+                                                            Collections.<String>emptySet(),\n+                                                            invalidTopic,\n+                                                            cluster.internalTopics(),\n+                                                            cluster.controller());\n+        client.prepareMetadataUpdate(metaDataUpdateResponseCluster, Collections.<String>emptySet());\n+\n+        Future<RecordMetadata> future = producer.send(record);\n+\n+        assertEquals(\"Cluster has incorrect invalid topic list.\", metaDataUpdateResponseCluster.invalidTopics(), metadata.fetch().invalidTopics());\n+        try {\n+            future.get(0, TimeUnit.MILLISECONDS);\n+            fail(\"Expected InvalidTopicException to be raised\");","path":"clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java","position":64,"original_position":64,"commit_id":"3e365e54b2219cc54f41bef30dcecd5c3f631cb6","original_commit_id":"3e365e54b2219cc54f41bef30dcecd5c3f631cb6","user":{"login":"ahmedha","id":8142137,"node_id":"MDQ6VXNlcjgxNDIxMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/8142137?v=4","gravatar_id":"","url":"https://api.github.com/users/ahmedha","html_url":"https://github.com/ahmedha","followers_url":"https://api.github.com/users/ahmedha/followers","following_url":"https://api.github.com/users/ahmedha/following{/other_user}","gists_url":"https://api.github.com/users/ahmedha/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedha/subscriptions","organizations_url":"https://api.github.com/users/ahmedha/orgs","repos_url":"https://api.github.com/users/ahmedha/repos","events_url":"https://api.github.com/users/ahmedha/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedha/received_events","type":"User","site_admin":false},"body":"If I use the ```expected``` attribute in ```@Test```, then the code will only be checking for```ExecutionException```, but the code as it stands now, checks against the cause of the exception (and compares to  InvalidTopicException).\r\n\r\nFor now, I will keep the code as is.  However, if you feel adding the expected attribute  adds to better readability, follow standard practice, I can make the change.","created_at":"2018-06-29T01:01:42Z","updated_at":"2018-06-29T01:06:27Z","html_url":"https://github.com/apache/kafka/pull/5247#discussion_r199029295","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/5247","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/199029295"},"html":{"href":"https://github.com/apache/kafka/pull/5247#discussion_r199029295"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/5247"}},"in_reply_to_id":199019528},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/5247","id":195618956,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1NjE4OTU2","html_url":"https://github.com/apache/kafka/pull/5247","diff_url":"https://github.com/apache/kafka/pull/5247.diff","patch_url":"https://github.com/apache/kafka/pull/5247.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/5247","number":5247,"state":"open","locked":false,"title":"KAFKA-5098: KafkaProducer.send() dose not block if topic name has ill…","user":{"login":"ahmedha","id":8142137,"node_id":"MDQ6VXNlcjgxNDIxMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/8142137?v=4","gravatar_id":"","url":"https://api.github.com/users/ahmedha","html_url":"https://github.com/ahmedha","followers_url":"https://api.github.com/users/ahmedha/followers","following_url":"https://api.github.com/users/ahmedha/following{/other_user}","gists_url":"https://api.github.com/users/ahmedha/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedha/subscriptions","organizations_url":"https://api.github.com/users/ahmedha/orgs","repos_url":"https://api.github.com/users/ahmedha/repos","events_url":"https://api.github.com/users/ahmedha/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedha/received_events","type":"User","site_admin":false},"body":"…egal char and generates InvalidTopicException\r\n\r\nIf config parameter max.block.ms config parameter is set to a non-zero value,\r\nKafkaProducer.send() blocks for the max.block.ms time if topic name has illegal\r\nchar or is invalid.\r\n\r\nWrote a unit test that verifies the appropriate exception is returned when\r\nperforming a get on the returned future by KafkaProducer.send().\r\n\r\n### Committer Checklist (excluded from commit message)\r\n- [ ] Verify design and implementation \r\n- [ ] Verify test coverage and CI build status\r\n- [ ] Verify documentation (including upgrade notes)\r\n","created_at":"2018-06-18T19:04:40Z","updated_at":"2018-06-29T01:06:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45fc33d6ecce65c73b82f529e08c68480d7a21b1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/5247/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/5247/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/5247/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/3e365e54b2219cc54f41bef30dcecd5c3f631cb6","head":{"label":"ahmedha:KAFKA-5098","ref":"KAFKA-5098","sha":"3e365e54b2219cc54f41bef30dcecd5c3f631cb6","user":{"login":"ahmedha","id":8142137,"node_id":"MDQ6VXNlcjgxNDIxMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/8142137?v=4","gravatar_id":"","url":"https://api.github.com/users/ahmedha","html_url":"https://github.com/ahmedha","followers_url":"https://api.github.com/users/ahmedha/followers","following_url":"https://api.github.com/users/ahmedha/following{/other_user}","gists_url":"https://api.github.com/users/ahmedha/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedha/subscriptions","organizations_url":"https://api.github.com/users/ahmedha/orgs","repos_url":"https://api.github.com/users/ahmedha/repos","events_url":"https://api.github.com/users/ahmedha/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedha/received_events","type":"User","site_admin":false},"repo":{"id":136233213,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYyMzMyMTM=","name":"kafka","full_name":"ahmedha/kafka","owner":{"login":"ahmedha","id":8142137,"node_id":"MDQ6VXNlcjgxNDIxMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/8142137?v=4","gravatar_id":"","url":"https://api.github.com/users/ahmedha","html_url":"https://github.com/ahmedha","followers_url":"https://api.github.com/users/ahmedha/followers","following_url":"https://api.github.com/users/ahmedha/following{/other_user}","gists_url":"https://api.github.com/users/ahmedha/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedha/subscriptions","organizations_url":"https://api.github.com/users/ahmedha/orgs","repos_url":"https://api.github.com/users/ahmedha/repos","events_url":"https://api.github.com/users/ahmedha/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ahmedha/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/ahmedha/kafka","forks_url":"https://api.github.com/repos/ahmedha/kafka/forks","keys_url":"https://api.github.com/repos/ahmedha/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ahmedha/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ahmedha/kafka/teams","hooks_url":"https://api.github.com/repos/ahmedha/kafka/hooks","issue_events_url":"https://api.github.com/repos/ahmedha/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/ahmedha/kafka/events","assignees_url":"https://api.github.com/repos/ahmedha/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/ahmedha/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/ahmedha/kafka/tags","blobs_url":"https://api.github.com/repos/ahmedha/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ahmedha/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ahmedha/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/ahmedha/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ahmedha/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/ahmedha/kafka/languages","stargazers_url":"https://api.github.com/repos/ahmedha/kafka/stargazers","contributors_url":"https://api.github.com/repos/ahmedha/kafka/contributors","subscribers_url":"https://api.github.com/repos/ahmedha/kafka/subscribers","subscription_url":"https://api.github.com/repos/ahmedha/kafka/subscription","commits_url":"https://api.github.com/repos/ahmedha/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/ahmedha/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/ahmedha/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/ahmedha/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/ahmedha/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/ahmedha/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ahmedha/kafka/merges","archive_url":"https://api.github.com/repos/ahmedha/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ahmedha/kafka/downloads","issues_url":"https://api.github.com/repos/ahmedha/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/ahmedha/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/ahmedha/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/ahmedha/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ahmedha/kafka/labels{/name}","releases_url":"https://api.github.com/repos/ahmedha/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/ahmedha/kafka/deployments","created_at":"2018-06-05T20:49:01Z","updated_at":"2018-06-18T17:51:45Z","pushed_at":"2018-06-21T14:18:32Z","git_url":"git://github.com/ahmedha/kafka.git","ssh_url":"git@github.com:ahmedha/kafka.git","clone_url":"https://github.com/ahmedha/kafka.git","svn_url":"https://github.com/ahmedha/kafka","homepage":null,"size":67889,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"1354371d4f4dd208458c776e1f27715ec5f77f47","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"node_id":"MDEwOlJlcG9zaXRvcnkyMjExMjQz","name":"kafka","full_name":"apache/kafka","owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/apache/kafka/deployments","created_at":"2011-08-15T18:06:16Z","updated_at":"2018-06-29T00:13:15Z","pushed_at":"2018-06-29T01:04:48Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":68801,"stargazers_count":8766,"watchers_count":8766,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5052,"mirror_url":null,"archived":false,"open_issues_count":463,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":5052,"open_issues":463,"watchers":8766,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/5247"},"html":{"href":"https://github.com/apache/kafka/pull/5247"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/5247"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/5247/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/5247/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/5247/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/3e365e54b2219cc54f41bef30dcecd5c3f631cb6"}},"author_association":"NONE"}}
{"actor":{"display_login":"ahmedha"}}