2024年3月24日发(作者:)

Process finished with exit code -1

CronExpression 源码:

protected void buildExpression(String expression) throws ParseException {

expressionParsed = true;

try {

if (seconds == null) {

seconds = new TreeSet();

}

if (minutes == null) {

minutes = new TreeSet();

}

if (hours == null) {

hours = new TreeSet();

}

if (daysOfMonth == null) {

daysOfMonth = new TreeSet();

}

if (months == null) {

months = new TreeSet();

}

if (daysOfWeek == null) {

daysOfWeek = new TreeSet();

}

if (years == null) {

years = new TreeSet();

}

int exprOn = SECOND;

StringTokenizer exprsTok = new StringTokenizer(expression, " t",

false);

while (eTokens() && exprOn <= YEAR) {

String expr = ken().trim();

// throw an exception if L is used with other days of the month

if(exprOn == DAY_OF_MONTH && f('L') != -1 && () > 1 && ns(",")) {

throw new ParseException("Support for specifying 'L' and 'LW' with other days of the month is not implemented", -1);

}

// throw an exception if L is used with other days of the week

if(exprOn == DAY_OF_WEEK && f('L') != -1 && () > 1 && ns(",")) {

throw new ParseException("Support for specifying 'L' with other days of the week is not implemented", -1);

}

if(exprOn == DAY_OF_WEEK && f('#') != -1 && f('#', f('#') +1) != -1) {

throw new ParseException("Support for specifying multiple "nth" days is not implemented.", -1);

}

StringTokenizer vTok = new StringTokenizer(expr, ",");

while (eTokens()) {

String v = ken();

storeExpressionVals(0, v, exprOn);

}

exprOn++;

}

if (exprOn <= DAY_OF_WEEK) {

throw new ParseException("Unexpected end of expression.",

());

}

if (exprOn <= YEAR) {

storeExpressionVals(0, "*", YEAR);

}

TreeSet dow = getSet(DAY_OF_WEEK);

TreeSet dom = getSet(DAY_OF_MONTH);

// Copying the logic from the UnsupportedOperationException below

boolean dayOfMSpec = !ns(NO_SPEC);

boolean dayOfWSpec = !ns(NO_SPEC);