Details
-
Improvement
-
Status: Closed
-
Low
-
Resolution: Fixed
-
None
-
None
Description
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()); } }