in config/src/main/java/com/alibaba/nacos/config/server/utils/ParamUtils.java [139:192]
public static void checkParam(Map<String, Object> configAdvanceInfo) throws NacosException {
for (Map.Entry<String, Object> configAdvanceInfoTmp : configAdvanceInfo.entrySet()) {
if (CONFIG_TAGS.equals(configAdvanceInfoTmp.getKey())) {
if (configAdvanceInfoTmp.getValue() != null) {
String[] tagArr = ((String) configAdvanceInfoTmp.getValue()).split(",");
if (tagArr.length > 5) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_VALIDATE_ERROR,
"too much config_tags, over 5");
}
for (String tag : tagArr) {
if (tag.length() > 64) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
ErrorCode.PARAMETER_VALIDATE_ERROR, "too long tag, over 64");
}
}
}
} else if (DESC.equals(configAdvanceInfoTmp.getKey())) {
if (configAdvanceInfoTmp.getValue() != null
&& ((String) configAdvanceInfoTmp.getValue()).length() > 128) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_VALIDATE_ERROR,
"too long desc, over 128");
}
} else if (USE.equals(configAdvanceInfoTmp.getKey())) {
if (configAdvanceInfoTmp.getValue() != null
&& ((String) configAdvanceInfoTmp.getValue()).length() > 32) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_VALIDATE_ERROR,
"too long use, over 32");
}
} else if (EFFECT.equals(configAdvanceInfoTmp.getKey())) {
if (configAdvanceInfoTmp.getValue() != null
&& ((String) configAdvanceInfoTmp.getValue()).length() > 32) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_VALIDATE_ERROR,
"too long effect, over 32");
}
} else if (TYPE.equals(configAdvanceInfoTmp.getKey())) {
if (configAdvanceInfoTmp.getValue() != null
&& ((String) configAdvanceInfoTmp.getValue()).length() > 32) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_VALIDATE_ERROR,
"too long type, over 32");
}
} else if (SCHEMA.equals(configAdvanceInfoTmp.getKey())) {
if (configAdvanceInfoTmp.getValue() != null
&& ((String) configAdvanceInfoTmp.getValue()).length() > 32768) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_VALIDATE_ERROR,
"too long schema, over 32768");
}
} else if (ENCRYPTED_DATA_KEY.equals(configAdvanceInfoTmp.getKey())) {
// No verification required
} else {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_VALIDATE_ERROR,
"invalid param");
}
}
}