Skip to content

Commit

Permalink
Revert "【1.1.15】bug fix (#288)"
Browse files Browse the repository at this point in the history
This reverts commit e464787
  • Loading branch information
casionone committed Sep 13, 2023
1 parent e464787 commit 8ed86c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ public Message saveKeyValue(HttpServletRequest req, @RequestBody Map<String, Obj
if (engineType.equals("*") && !version.equals("*")) {
return Message.error("When engineType is any engine, the version must also be any version");
}
if (StringUtils.isBlank(configKey)) {
return Message.error("key cannot be empty");
if (StringUtils.isBlank(configKey) || StringUtils.isBlank(value)) {
return Message.error("key or value cannot be empty");
}
if (StringUtils.isNotBlank(user)) {
username = user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public class ConfigKeyServiceImpl implements ConfigKeyService {
public ConfigValue saveConfigValue(ConfigKeyValue configKeyValue, List<Label<?>> labelList)
throws ConfigurationException {

if (StringUtils.isBlank(configKeyValue.getKey())) {
if (StringUtils.isBlank(configKeyValue.getConfigValue())
|| StringUtils.isBlank(configKeyValue.getKey())) {
throw new ConfigurationException(KEY_OR_VALUE_CANNOT.getErrorDesc());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,35 +224,31 @@ class ConfigurationService extends Logging {
}

def paramCheck(setting: ConfigKeyValue): Unit = {
var key: ConfigKey = null
if (setting.getId != null) {
key = configMapper.selectKeyByKeyID(setting.getId)
} else {
val keys = configMapper.selectKeyByKeyName(setting.getKey)
if (null != keys && !keys.isEmpty) {
key = keys.get(0)
if (!StringUtils.isEmpty(setting.getConfigValue)) {
var key: ConfigKey = null
if (setting.getId != null) {
key = configMapper.selectKeyByKeyID(setting.getId)
} else {
val keys = configMapper.selectKeyByKeyName(setting.getKey)
if (null != keys && !keys.isEmpty) {
key = keys.get(0)
}
}
}
if (key == null) {
throw new ConfigurationException("config key is null, please check again!(配置信息为空,请重新检查key值)")
}
if (StringUtils.isNotBlank(key.getDefaultValue)) {
if (StringUtils.isNotBlank(setting.getConfigValue)) {
logger.info(
s"parameter ${key.getKey} value ${setting.getConfigValue} is not empty, enter checksum...(参数${key.getKey}${setting.getConfigValue}不为空,进入校验...)"
if (key == null) {
throw new ConfigurationException(
"config key is null, please check again!(配置信息为空,请重新检查key值)"
)
if (
!validatorManager
.getOrCreateValidator(key.getValidateType)
.validate(setting.getConfigValue, key.getValidateRange)
) {
throw new ConfigurationException(
s"Parameter verification failed(参数校验失败):${key.getKey}--${key.getValidateType}--${key.getValidateRange}--${setting.getConfigValue}"
)
}
} else {
}
logger.info(
s"parameter ${key.getKey} value ${setting.getConfigValue} is not empty, enter checksum...(参数${key.getKey}${setting.getConfigValue}不为空,进入校验...)"
)
if (
!validatorManager
.getOrCreateValidator(key.getValidateType)
.validate(setting.getConfigValue, key.getValidateRange)
) {
throw new ConfigurationException(
"config value is null, please check again!(配置信息为空,请重新检查value值)"
s"Parameter verification failed(参数校验失败):${key.getKey}--${key.getValidateType}--${key.getValidateRange}--${setting.getConfigValue}"
)
}
}
Expand Down

0 comments on commit 8ed86c5

Please sign in to comment.