"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-context/src/main/java/org/springframework/scheduling/support/CronExpression.java" between
spring-framework-5.3.7.tar.gz and spring-framework-5.3.8.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

CronExpression.java  (spring-framework-5.3.7):CronExpression.java  (spring-framework-5.3.8)
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* https://www.apache.org/licenses/LICENSE-2.0 * https://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
skipping to change at line 202 skipping to change at line 202
CronField daysOfWeek = CronField.parseDaysOfWeek(fields[5 ]); CronField daysOfWeek = CronField.parseDaysOfWeek(fields[5 ]);
return new CronExpression(seconds, minutes, hours, daysOf Month, months, daysOfWeek, expression); return new CronExpression(seconds, minutes, hours, daysOf Month, months, daysOfWeek, expression);
} }
catch (IllegalArgumentException ex) { catch (IllegalArgumentException ex) {
String msg = ex.getMessage() + " in cron expression \"" + expression + "\""; String msg = ex.getMessage() + " in cron expression \"" + expression + "\"";
throw new IllegalArgumentException(msg, ex); throw new IllegalArgumentException(msg, ex);
} }
} }
/**
* Determine whether the given string represents a valid cron expression.
* @param expression the expression to evaluate
* @return {@code true} if the given expression is a valid cron expressio
n
* @since 5.3.8
*/
public static boolean isValidExpression(@Nullable String expression) {
if (expression == null) {
return false;
}
try {
parse(expression);
return true;
}
catch (IllegalArgumentException ex) {
return false;
}
}
private static String resolveMacros(String expression) { private static String resolveMacros(String expression) {
expression = expression.trim(); expression = expression.trim();
for (int i = 0; i < MACROS.length; i = i + 2) { for (int i = 0; i < MACROS.length; i = i + 2) {
if (MACROS[i].equalsIgnoreCase(expression)) { if (MACROS[i].equalsIgnoreCase(expression)) {
return MACROS[i + 1]; return MACROS[i + 1];
} }
} }
return expression; return expression;
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)