Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-96] Fix typo & use IllegalArgumentException #695

Closed
dockerzhang opened this issue Jul 28, 2021 · 0 comments
Closed

[INLONG-96] Fix typo & use IllegalArgumentException #695

dockerzhang opened this issue Jul 28, 2021 · 0 comments

Comments

@dockerzhang
Copy link
Contributor

1. Fix typo
validConsumerGroupParmeter -> validConsumerGroupParameter
pushIsListenerWaitTimeoutRollBack -> pushListenerWaitTimeoutRollBack
pushIsListenerThrowedRollBack -> pushListenerThrowedRollBack

2. Use IllegalArgumentException
In ConsumerConfig#validConsumerGroupParameter

private void validConsumerGroupParameter(String consumerGroup) throws Exception {
if (TStringUtils.isBlank(consumerGroup)) {
    throw new Exception("Illegal parameter: consumerGroup is Blank!");
}
String tmpConsumerGroup = String.valueOf(consumerGroup).trim();
if (tmpConsumerGroup.length() > TBaseConstants.META_MAX_GROUPNAME_LENGTH) {
    throw new Exception(new StringBuilder(512)
    .append("Illegal parameter: the max length of consumerGroup is ")
    .append(TBaseConstants.META_MAX_GROUPNAME_LENGTH)
    .append(" characters").toString());
}
if (!tmpConsumerGroup.matches(TBaseConstants.META_TMP_GROUP_VALUE)) {
    throw new Exception(new StringBuilder(512)
    .append("Illegal parameter: the value of consumerGroup")
    .append(" must begin with a letter, ")
    .append("can only contain characters,numbers,hyphen,and underscores").toString());
}
    }

will change to throw IllegalArgumentException

private void validConsumerGroupParameter(String consumerGroup) throws Exception {
if (TStringUtils.isBlank(consumerGroup)) {
    throw new IllegalArgumentException("Illegal parameter: consumerGroup is Blank!");
}
String tmpConsumerGroup = String.valueOf(consumerGroup).trim();
if (tmpConsumerGroup.length() > TBaseConstants.META_MAX_GROUPNAME_LENGTH) {
    throw new IllegalArgumentException(new StringBuilder(512)
    .append("Illegal parameter: the max length of consumerGroup is ")
    .append(TBaseConstants.META_MAX_GROUPNAME_LENGTH)
    .append(" characters").toString());
}
if (!tmpConsumerGroup.matches(TBaseConstants.META_TMP_GROUP_VALUE)) {
    throw new IllegalArgumentException(new StringBuilder(512)
    .append("Illegal parameter: the value of consumerGroup")
    .append(" must begin with a letter, ")
    .append("can only contain characters,numbers,hyphen,and underscores").toString());
}
    }
JIRA link - [INLONG-96] created by technoboy
@dockerzhang dockerzhang added this to the 0.5.0 milestone Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant