{"record":{"id":"e7275e4de3891b13","repo":"paascloud/paascloud-master","slug":"uac10011020","errorCode":"UAC10011020","errorMessage":"UAC10011020","messagePattern":"UAC10011020","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"paascloud-common/paascloud-common-base/src/main/java/com/paascloud/base/constant/AliyunSmsConstants.java","lineNumber":58,"sourceCode":"\t\tprivate String templetCode;\n\n\t\tprivate String smsParamName;\n\n\t\tpublic static SmsTempletEnum getEnum(String templateCode) {\n\t\t\tSmsTempletEnum smsTempletEnum = null;\n\t\t\tfor (SmsTempletEnum ele : SmsTempletEnum.values()) {\n\t\t\t\tif (templateCode.equals(ele.getTempletCode())) {\n\t\t\t\t\tsmsTempletEnum = ele;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn smsTempletEnum;\n\t\t}\n\n\t\tpublic static boolean isSmsTemplate(String smsTemplateCode) {\n\n\t\t\tif (StringUtils.isEmpty(smsTemplateCode)) {\n\t\t\t\tthrow new BusinessException(ErrorCodeEnum.UAC10011020);\n\t\t\t}\n\t\t\tList<String> templetCodeList = getTemplateCodeList();\n\n\t\t\treturn templetCodeList.contains(smsTemplateCode);\n\t\t}\n\n\t\tpublic static List<SmsTempletEnum> getList() {\n\t\t\treturn Arrays.asList(SmsTempletEnum.values());\n\t\t}\n\n\t\tpublic static List<String> getTemplateCodeList() {\n\t\t\tList<String> templetCodeList = Lists.newArrayList();\n\t\t\tList<SmsTempletEnum> list = getList();\n\t\t\tfor (SmsTempletEnum templetEnum : list) {\n\t\t\t\tif (StringUtils.isEmpty(templetEnum.getTempletCode())) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\ttempletCodeList.add(templetEnum.getTempletCode());","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-common/paascloud-common-base/src/main/java/com/paascloud/base/constant/AliyunSmsConstants.java#L40-L76","documentation":"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.","triggerScenarios":"Calling AliyunSmsConstants.isSmsTemplate(null) or isSmsTemplate(\"\") — e.g. a missing sms.template.code property resolved to an empty string before the call.","commonSituations":"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.","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."],"exampleFix":"// before\nboolean ok = AliyunSmsConstants.isSmsTemplate(config.getCode());\n// after\nif (StringUtils.isBlank(config.getCode())) {\n    throw new IllegalStateException(\"sms template code is not configured\");\n}\nboolean ok = AliyunSmsConstants.isSmsTemplate(config.getCode());","handlingStrategy":"validation","validationCode":"if (smsTemplateCode == null || smsTemplateCode.trim().isEmpty()) {\n    throw new IllegalStateException(\"smsTemplateCode must be configured before validation\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    boolean valid = AliyunSmsConstants.isSmsTemplate(code);\n} catch (BusinessException e) {\n    log.error(\"sms template code missing/invalid\", e);\n}","preventionTips":["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."],"tags":["sms","validation","empty-argument","aliyun"],"backgroundTag":"empty-required-field","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}