mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
Merge pull request #692 from tellmenow/v5-master
Object的equals方法容易抛空指针异常,用java8的Objects.equals替换
This commit is contained in:
@@ -2,6 +2,8 @@ package cn.hutool.cron.pattern.parser;
|
||||
|
||||
import cn.hutool.cron.CronException;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 每月的几号值处理<br>
|
||||
* 每月最多31天,32和“L”都表示最后一天
|
||||
@@ -17,7 +19,7 @@ public class DayOfMonthValueParser extends SimpleValueParser {
|
||||
|
||||
@Override
|
||||
public int parse(String value) throws CronException {
|
||||
if (value.equalsIgnoreCase("L") || value.equals("32")) {// 每月最后一天
|
||||
if ("L".equalsIgnoreCase(value) || Objects.equals("32",value)) {// 每月最后一天
|
||||
return 32;
|
||||
} else {
|
||||
return super.parse(value);
|
||||
|
@@ -38,7 +38,7 @@ public class DayOfWeekValueParser extends SimpleValueParser {
|
||||
* @throws CronException 无效别名抛出此异常
|
||||
*/
|
||||
private int parseAlias(String value) throws CronException {
|
||||
if(value.equalsIgnoreCase("L")){
|
||||
if("L".equalsIgnoreCase(value)){
|
||||
//最后一天为星期六
|
||||
return ALIASES.length - 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user