paascloud/paascloud-master · error · BusinessException
UAC10011020
UAC10011020
Error message
UAC10011020
What it means
AliyunSmsConstants.isSmsTemplate throws ErrorCodeEnum.UAC10011020 when the smsTemplateCode argument is null or empty. The method exists to validate a template code against the enum's known template codes, so it refuses to even answer for a blank input. This is a fail-fast guard against passing empty SMS template configuration into the Aliyun SMS flow.
Solutions
- Check the caller's template-code variable; ensure it is populated before calling isSmsTemplate.
- Fix the configuration source (application.yml/properties or @ConfigurationProperties binding) so the SMS template code is set.
- Use StringUtils.isBlank upfront in your own code and supply a sensible default or fail with a clearer message.
Example fix
// before
boolean ok = AliyunSmsConstants.isSmsTemplate(config.getCode());
// after
if (StringUtils.isBlank(config.getCode())) {
throw new IllegalStateException("sms template code is not configured");
}
boolean ok = AliyunSmsConstants.isSmsTemplate(config.getCode()); Defensive patterns
Strategy: validation
Validate before calling
if (smsTemplateCode == null || smsTemplateCode.trim().isEmpty()) {
throw new IllegalStateException("smsTemplateCode must be configured before validation");
} Try / catch
try {
boolean valid = AliyunSmsConstants.isSmsTemplate(code);
} catch (BusinessException e) {
log.error("sms template code missing/invalid", e);
} Prevention
- Bind SMS template code via @ConfigurationProperties with a notBlank constraint so startup fails fast.
- Add a unit test asserting the configured template code is non-empty.
- Never pass properties straight from yml into isSmsTemplate without a blank check.
When it happens
Trigger: Calling AliyunSmsConstants.isSmsTemplate(null) or isSmsTemplate("") — e.g. a missing sms.template.code property resolved to an empty string before the call.
Common situations: Spring config placeholder not resolved (smsTemplateCode=${sms.code} with no value), application.yml key missing or misnamed, or a profile lacking the SMS template property.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/e7275e4de3891b13.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-common/paascloud-common-base/src/main/java/com/paascloud/base/constant/AliyunSmsConstants.java:58
private String templetCode;
private String smsParamName;
public static SmsTempletEnum getEnum(String templateCode) {
SmsTempletEnum smsTempletEnum = null;
for (SmsTempletEnum ele : SmsTempletEnum.values()) {
if (templateCode.equals(ele.getTempletCode())) {
smsTempletEnum = ele;
break;
}
}
return smsTempletEnum;
}
public static boolean isSmsTemplate(String smsTemplateCode) {
if (StringUtils.isEmpty(smsTemplateCode)) {
throw new BusinessException(ErrorCodeEnum.UAC10011020);
}
List<String> templetCodeList = getTemplateCodeList();
return templetCodeList.contains(smsTemplateCode);
}
public static List<SmsTempletEnum> getList() {
return Arrays.asList(SmsTempletEnum.values());
}
public static List<String> getTemplateCodeList() {
List<String> templetCodeList = Lists.newArrayList();
List<SmsTempletEnum> list = getList();
for (SmsTempletEnum templetEnum : list) {
if (StringUtils.isEmpty(templetEnum.getTempletCode())) {
continue;
}
templetCodeList.add(templetEnum.getTempletCode());View on GitHub (pinned to 781281a950)