fix:修复可能存在的空指针问题

pull/37/head
da-daken 2 years ago
parent e30afb0c35
commit c57f1601a0

@ -1,5 +1,6 @@
package com.java3y.austin.service.api.impl.service;
import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.service.api.domain.SendRequest;
import com.java3y.austin.service.api.domain.SendResponse;
@ -7,6 +8,7 @@ import com.java3y.austin.service.api.impl.domain.SendTaskModel;
import com.java3y.austin.service.api.service.RecallService;
import com.java3y.austin.support.pipeline.ProcessContext;
import com.java3y.austin.support.pipeline.ProcessController;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,6 +26,10 @@ public class RecallServiceImpl implements RecallService {
@Override
public SendResponse recall(SendRequest sendRequest) {
// 添加对 sendRequest 参数的判空,防止后面空指针
if(ObjectUtils.isEmpty(sendRequest)){
return new SendResponse(RespStatusEnum.CLIENT_BAD_PARAMETERS.getCode(), RespStatusEnum.CLIENT_BAD_PARAMETERS.getMsg());
}
SendTaskModel sendTaskModel = SendTaskModel.builder()
.messageTemplateId(sendRequest.getMessageTemplateId())
.build();

@ -1,6 +1,7 @@
package com.java3y.austin.service.api.impl.service;
import cn.monitor4all.logRecord.annotation.OperationLog;
import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.service.api.domain.BatchSendRequest;
import com.java3y.austin.service.api.domain.SendRequest;
@ -9,6 +10,7 @@ import com.java3y.austin.service.api.impl.domain.SendTaskModel;
import com.java3y.austin.service.api.service.SendService;
import com.java3y.austin.support.pipeline.ProcessContext;
import com.java3y.austin.support.pipeline.ProcessController;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -28,6 +30,10 @@ public class SendServiceImpl implements SendService {
@Override
@OperationLog(bizType = "SendService#send", bizId = "#sendRequest.messageTemplateId", msg = "#sendRequest")
public SendResponse send(SendRequest sendRequest) {
// 添加对 sendRequest 参数的判空,防止后面空指针
if(ObjectUtils.isEmpty(sendRequest)){
return new SendResponse(RespStatusEnum.CLIENT_BAD_PARAMETERS.getCode(), RespStatusEnum.CLIENT_BAD_PARAMETERS.getMsg());
}
SendTaskModel sendTaskModel = SendTaskModel.builder()
.messageTemplateId(sendRequest.getMessageTemplateId())

Loading…
Cancel
Save