{"record":{"id":"d32bc5e94a442e2c","repo":"jeecgboot/JeecgBoot","slug":"unexpected-character-c","errorCode":null,"errorMessage":"Unexpected character: {c}","messagePattern":"Unexpected character: (.+?)","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-xxljob/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java","lineNumber":720,"sourceCode":"            }\n            return i;\n        } else if (c >= '0' && c <= '9') {\n            int val = Integer.parseInt(String.valueOf(c));\n            i++;\n            if (i >= s.length()) {\n                addToSet(val, -1, -1, type);\n            } else {\n                c = s.charAt(i);\n                if (c >= '0' && c <= '9') {\n                    ValueSet vs = getValue(val, s, i);\n                    val = vs.value;\n                    i = vs.pos;\n                }\n                i = checkNext(i, s, val, type);\n                return i;\n            }\n        } else {\n            throw new ParseException(\"Unexpected character: \" + c, i);\n        }\n\n        return i;\n    }\n\n    private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {\n        if (incr > 59 && (type == SECOND || type == MINUTE)) {\n            throw new ParseException(\"Increment >= 60 : \" + incr, idxPos);\n        } else if (incr > 23 && (type == HOUR)) {\n            throw new ParseException(\"Increment >= 24 : \" + incr, idxPos);\n        } else if (incr > 31 && (type == DAY_OF_MONTH)) {\n            throw new ParseException(\"Increment >= 31 : \" + incr, idxPos);\n        } else if (incr > 7 && (type == DAY_OF_WEEK)) {\n            throw new ParseException(\"Increment >= 7 : \" + incr, idxPos);\n        } else if (incr > 12 && (type == MONTH)) {\n            throw new ParseException(\"Increment >= 12 : \" + incr, idxPos);\n        }\n    }","sourceCodeStart":702,"sourceCodeEnd":738,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-xxljob/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java#L702-L738","documentation":"The terminal else of storeExpressionVals: the current character c matched none of the recognized branches (not A-Z alpha, not '?', not '*' or '/', not 'L', not a digit 0-9). Any unrecognised symbol - punctuation, lowercase, special chars - lands here. It is the fallback for truly unexpected characters at a position where a value was expected.","triggerScenarios":"Characters like '@', '#', '!', '.', ',', lowercase letters, or a stray symbol in a value position: '0 0 0 ,5 * * ?' (leading comma), '0 0 0 #5 * * ?', '0 0 0 5.5 * * ?', or lowercase 'l' instead of 'L'.","commonSituations":"Locale-specific separators (e.g. decimal comma), stray punctuation from copy/paste, lowercase 'l'/'w' that should be uppercase, or a typo inserting a symbol.","solutions":["Inspect the character at the reported position and replace it with a valid token (digit, '*', '?', '/', '-', 'L', or 'W' where supported).","Use ',' only between list elements inside a field, not at the start/end.","Uppercase all letter modifiers ('L', 'W'); the parser only enters the alpha branch for A-Z.","Strip non-cron characters from pasted expressions before parsing."],"exampleFix":"// before - stray '.' in day-of-month\nString cron = \"0 0 0 5.5 * ?\";  // Unexpected character: .\n\n// after - valid list or single value\nString cron = \"0 0 0 5,15 * ?\";","handlingStrategy":"validation","validationCode":"// Whitelist the allowed character set for the whole expression before parsing.\nprivate static final java.util.regex.Pattern CRON_CHARSET =\n    java.util.regex.Pattern.compile(\"^[0-9*?/\\\\-,LW# A-Za-z]+$\");\n\npublic static String validateCharset(String expr) {\n    if (expr == null || !CRON_CHARSET.matcher(expr).matches()) {\n        return \"expression contains characters outside the allowed cron charset: \" + expr;\n    }\n    return null;\n}","typeGuard":"public static boolean usesAllowedCronCharset(String expr) {\n    return expr != null && expr.matches(\"[0-9*?/\\\\-,LW# A-Za-z]+\");\n}","tryCatchPattern":"try {\n    new CronExpression(expr);\n} catch (ParseException e) {\n    if (e.getMessage().startsWith(\"Unexpected character\")) {\n        return \"Remove the symbol at the reported position; only 0-9 * ? / - , L W # and letters are allowed. \" + e.getMessage();\n    }\n    throw e;\n}","preventionTips":["Sanitize pasted cron strings against the allowed charset before parsing.","Uppercase all letter modifiers ('L', 'W'); lowercase is rejected.","Reject decimal commas/points and stray punctuation in the input UI."],"tags":["cron","xxl-job","syntax-error","validation","parse-error"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}