Introducing new features. 格式化xxl-job 不规范代码

This commit is contained in:
lbw 2021-01-16 11:09:23 +08:00
parent c47147bbf8
commit 7c06ed414d
2 changed files with 17 additions and 10 deletions

View File

@ -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;

View File

@ -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<Integer> set = getSet(type);
set.add(val);
i++;