mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
fix: can creating a job with the wrong parameters #312
This commit is contained in:
parent
e094c22952
commit
4c0e5f348b
@ -173,4 +173,11 @@ public class CommonUtils {
|
||||
} catch (InterruptedException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ignore compile warning of 'Result of 'Long.valueOf()' is ignored '
|
||||
* @param obj anything
|
||||
*/
|
||||
public static void ignoreIgnoredResultWarning(Object obj) {
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import tech.powerjob.common.PowerQuery;
|
||||
import tech.powerjob.common.enums.TimeExpressionType;
|
||||
import tech.powerjob.common.request.http.SaveJobInfoRequest;
|
||||
import tech.powerjob.common.response.JobInfoDTO;
|
||||
import tech.powerjob.common.utils.CommonUtils;
|
||||
import tech.powerjob.server.common.SJ;
|
||||
import tech.powerjob.server.common.constants.SwitchableStatus;
|
||||
import tech.powerjob.server.common.utils.CronExpression;
|
||||
@ -61,7 +62,7 @@ public class JobService {
|
||||
*/
|
||||
public Long saveJob(SaveJobInfoRequest request) throws ParseException {
|
||||
|
||||
request.valid();
|
||||
checkValid(request);
|
||||
|
||||
JobInfoDO jobInfoDO;
|
||||
if (request.getId() != null) {
|
||||
@ -278,4 +279,13 @@ public class JobService {
|
||||
return jobInfoDTO;
|
||||
}
|
||||
|
||||
private static void checkValid(SaveJobInfoRequest request) {
|
||||
|
||||
request.valid();
|
||||
|
||||
if (TimeExpressionType.frequentTypes.contains(request.getTimeExpressionType().getV())) {
|
||||
CommonUtils.ignoreIgnoredResultWarning(Long.valueOf(request.getTimeExpression()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user