Ver Fonte

【优化】Cron解析组件优化代码优化。

xuxueli há 1 ano atrás
pai
commit
843c82270d

+ 3 - 2
doc/XXL-JOB官方文档.md

@@ -2369,8 +2369,9 @@ public void execute() {
 ### 7.35 版本 v2.4.2 Release Notes[规划中]
 - 1、【升级】多个项目依赖升级至较新稳定版本,涉及netty、groovy、gson、springboot、mybatis等;
 - 2、【修复】"CVE-2024-42681" 子任务越权漏洞修复;
-
-- 2、[规划中]登陆态Token声称逻辑优化,混淆登陆时间属性,降低token泄漏风险。
+- 3、【优化】Cron解析组件优化代码优化。
+- 3、[规划中]安全功能增强,通讯加密参数改用加密数据避免AccessToken明文, 降低token泄漏风险。
+- 4、[规划中]登陆态Token声称逻辑优化,混淆登陆时间属性,降低token泄漏风险。
 
 ### TODO LIST
 - 1、调度隔离:调度中心针对不同执行器,各自维护不同的调度和远程触发组件。

+ 10 - 7
xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java

@@ -363,9 +363,9 @@ public final class CronExpression implements Serializable, Cloneable {
         // the second immediately following it.
         while (difference == 1000) {
             newDate = getTimeAfter(lastDate);
-            if(newDate == null)
+            if(newDate == null) {
                 break;
-            
+            }
             difference = newDate.getTime() - lastDate.getTime();
             
             if (difference == 1000) {
@@ -668,8 +668,9 @@ public final class CronExpression implements Serializable, Cloneable {
                 if(c == '-') {
                     ValueSet vs = getValue(0, s, i+1);
                     lastdayOffset = vs.value;
-                    if(lastdayOffset > 30)
-                        throw new ParseException("Offset from last day must be <= 30", i+1);
+                    if(lastdayOffset > 30) {
+                        throw new ParseException("Offset from last day must be <= 30", i + 1);
+                    }
                     i = vs.pos;
                 }                        
                 if(s.length() > i) {
@@ -732,8 +733,9 @@ public final class CronExpression implements Serializable, Cloneable {
 
         if (c == 'L') {
             if (type == DAY_OF_WEEK) {
-                if(val < 1 || val > 7)
+                if(val < 1 || val > 7) {
                     throw new ParseException("Day-of-Week values must be between 1 and 7", -1);
+                }
                 lastdayOfWeek = true;
             } else {
                 throw new ParseException("'L' option is not valid here. (pos=" + i + ")", i);
@@ -750,8 +752,9 @@ public final class CronExpression implements Serializable, Cloneable {
             } else {
                 throw new ParseException("'W' option is not valid here. (pos=" + i + ")", i);
             }
-            if(val > 31)
-                throw new ParseException("The 'W' option does not make sense with values larger than 31 (max number of days in a month)", i); 
+            if(val > 31) {
+                throw new ParseException("The 'W' option does not make sense with values larger than 31 (max number of days in a month)", i);
+            }
             TreeSet<Integer> set = getSet(type);
             set.add(val);
             i++;