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 2022/09/16 09:10:52 UTC

[GitHub] [pulsar] poorbarcode commented on a diff in pull request #17151: [fix][broker] Added check for invisible characters for subscription name

poorbarcode commented on code in PR #17151:
URL: https://github.com/apache/pulsar/pull/17151#discussion_r972812994


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/CreateSubscriptionTest.java:
##########
@@ -135,6 +135,46 @@ public void createSubscriptionOnPartitionedTopic() throws Exception {
         }
     }
 
+    public void testContainsInvisibleCharactersForSubscriptionName() throws PulsarAdminException {
+        String topic = "persistent://my-property/my-ns/my-partitioned-topic";
+        admin.topics().createPartitionedTopic(topic, 10);
+        admin.topics().createSubscription(topic, "sub-1", MessageId.latest);
+        admin.topics().createSubscription(topic, "sub~`!@#$¥%^……&*(){「【[]}】』\\|、:;\"'<《,>。》.?/-1",
+                MessageId.latest);
+
+        // Create should fail if the subscription name contain invisible characters
+        try {
+            admin.topics().createSubscription(topic, "sub\u0000-2", MessageId.latest);
+            fail("Should have failed");
+        } catch (Exception e) {
+            // Expected

Review Comment:
   could we check the response status and error message?



-- 
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: commits-unsubscribe@pulsar.apache.org

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