提交 50ba523b 编写于 作者: R rongtong 提交者: Heng Du

[ISSUE #1699] Fix wrong topic max length in TopicValidator (#1700)

* fix(topicValidator):fix topic max length to 127

* test(topicValidator):modify relate tests
上级 1c02afd1
......@@ -27,7 +27,7 @@ public class TopicValidator {
private static final String VALID_PATTERN_STR = "^[%|a-zA-Z0-9_-]+$";
private static final Pattern PATTERN = Pattern.compile(VALID_PATTERN_STR);
private static final int CHARACTER_MAX_LENGTH = 255;
private static final int TOPIC_MAX_LENGTH = 127;
private static boolean regularExpressionMatcher(String origin, Pattern pattern) {
if (pattern == null) {
......@@ -51,9 +51,9 @@ public class TopicValidator {
return false;
}
if (topic.length() > CHARACTER_MAX_LENGTH) {
if (topic.length() > TOPIC_MAX_LENGTH) {
response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark("The specified topic is longer than topic max length 255.");
response.setRemark("The specified topic is longer than topic max length.");
return false;
}
......
......@@ -47,10 +47,10 @@ public class TopicValidatorTest {
assertThat(response.getRemark()).contains("The specified topic is conflict with AUTO_CREATE_TOPIC_KEY_TOPIC.");
clearResponse(response);
res = TopicValidator.validateTopic(generateString(255), response);
res = TopicValidator.validateTopic(generateString(128), response);
assertThat(res).isFalse();
assertThat(response.getCode()).isEqualTo(ResponseCode.SYSTEM_ERROR);
assertThat(response.getRemark()).contains("The specified topic is longer than topic max length 255.");
assertThat(response.getRemark()).contains("The specified topic is longer than topic max length.");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册