dromara/Sa-Token · info · SaTokenException
12103
12103
Error message
{cause} What it means
SaFoxUtil.encodeUrl wraps URLEncoder.encode(url, "UTF-8") and converts the theoretically possible UnsupportedEncodingException into SaTokenException code 12103. In practice this branch is dead code: every conforming JVM (including Java 8+) is required to support UTF-8, so the exception can essentially never occur. Code 12103 exists purely to satisfy checked-exception handling.
Source
Thrown at sa-token-core/src/main/java/cn/dev33/satoken/util/SaFoxUtil.java:585
* @return 拼接后的url字符串
*/
public static boolean isUrl(String str) {
if(isEmpty(str)) {
return false;
}
return str.toLowerCase().matches(URL_REGEX);
}
/**
* URL编码
* @param url see note
* @return see note
*/
public static String encodeUrl(String url) {
try {
return URLEncoder.encode(url, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new SaTokenException(e).setCode(SaErrorCode.CODE_12103);
}
}
/**
* URL解码
* @param url see note
* @return see note
*/
public static String decoderUrl(String url) {
try {
return URLDecoder.decode(url, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new SaTokenException(e).setCode(SaErrorCode.CODE_12104);
}
}
/**
* 将指定字符串按照逗号分隔符转化为字符串集合View on GitHub (pinned to ac2c7f6e94)
Solutions
- Treat any occurrence as a broken runtime: verify the JDK vendor/version (java -version) and re-run on a standard JDK
- No code change needed — do not add handling for this in business logic
Defensive patterns
Strategy: fallback
Prevention
- Do not write handling for this branch — UTF-8 always exists on standard JVMs
- If it ever fires, treat the runtime JDK as broken and replace it
When it happens
Trigger: Only if the runtime JDK does not support the charset name 'UTF-8' — impossible on standard JDK distributions; a tampered/incorrect JRE would be the sole case.
Common situations: Never observed in normal deployments; developers mainly encounter code 12103 while reading source or grepping for SaErrorCode meanings.
Related errors
AI-assisted analysis of dromara/Sa-Token@ac2c7f6e94 (2026-08-14).
Data as JSON: /api/errors/41ce1776e5af6636.
Report an issue: GitHub.