From 7c06ed414d40c93f9a15237456fad79978aa90db Mon Sep 17 00:00:00 2001 From: lbw Date: Sat, 16 Jan 2021 11:09:23 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Introducing=20new=20features.=20?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96xxl-job=20=E4=B8=8D=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../job/admin/core/alarm/impl/EmailJobAlarm.java | 15 +++++++++------ .../xxl/job/admin/core/cron/CronExpression.java | 12 ++++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java b/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java index 8a8aa7b1..4c5ab092 100644 --- a/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java +++ b/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/impl/EmailJobAlarm.java @@ -1,5 +1,12 @@ package com.xxl.job.admin.core.alarm.impl; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.mail.internet.MimeMessage; + import com.xxl.job.admin.core.alarm.JobAlarm; import com.xxl.job.admin.core.conf.XxlJobAdminConfig; import com.xxl.job.admin.core.model.XxlJobGroup; @@ -9,15 +16,10 @@ import com.xxl.job.admin.core.util.I18nUtil; import com.xxl.job.core.biz.model.ReturnT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Component; -import javax.mail.internet.MimeMessage; -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - /** * job alarm by email * @@ -32,6 +34,7 @@ public class EmailJobAlarm implements JobAlarm { * fail alarm * @param jobLog */ + @Override public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog) { boolean alarmResult = true; diff --git a/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java b/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java index dc09db3f..8173104e 100644 --- a/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java +++ b/pig-visual/pig-xxl-job-admin/src/main/java/com/xxl/job/admin/core/cron/CronExpression.java @@ -369,8 +369,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(); @@ -666,8 +667,9 @@ public final class CronExpression implements Serializable, Cloneable { if (c == '-') { ValueSet vs = getValue(0, s, i + 1); lastdayOffset = vs.value; - if (lastdayOffset > 30) + if (lastdayOffset > 30) { throw new ParseException("Offset from last day must be <= 30", i + 1); + } i = vs.pos; } if (s.length() > i) { @@ -736,8 +738,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 { @@ -756,10 +759,11 @@ public final class CronExpression implements Serializable, Cloneable { else { throw new ParseException("'W' option is not valid here. (pos=" + i + ")", i); } - if (val > 31) + 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 set = getSet(type); set.add(val); i++;