fix: SpotBugs扫描分析(三):修复可能的溢出与NPE问题

pull/66/head
xiaoxiamo 4 months ago
parent 298ec9703d
commit a486063b7f

@ -168,7 +168,8 @@ public class CronTaskServiceImpl implements CronTaskService {
response != null ? JSON.toJSONString(response.body()) : ""); response != null ? JSON.toJSONString(response.body()) : "");
} }
invalidateCookie(); invalidateCookie();
return BasicResultVO.fail(RespStatusEnum.SERVICE_ERROR, JSON.toJSONString(response.body())); return BasicResultVO.fail(RespStatusEnum.SERVICE_ERROR,
response != null ? JSON.toJSONString(response.body()) : "");
} }
@Override @Override

@ -9,7 +9,6 @@ import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
import com.dingtalk.api.request.OapiMessageCorpconversationGetsendresultRequest; import com.dingtalk.api.request.OapiMessageCorpconversationGetsendresultRequest;
import com.dingtalk.api.request.OapiMessageCorpconversationRecallRequest; import com.dingtalk.api.request.OapiMessageCorpconversationRecallRequest;
import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response; import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
import com.dingtalk.api.response.OapiMessageCorpconversationGetsendresultResponse;
import com.dingtalk.api.response.OapiMessageCorpconversationRecallResponse; import com.dingtalk.api.response.OapiMessageCorpconversationRecallResponse;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant; import com.java3y.austin.common.constant.AustinConstant;
@ -179,7 +178,7 @@ public class DingDingWorkNoticeHandler extends BaseHandler{
OapiMessageCorpconversationGetsendresultRequest req = new OapiMessageCorpconversationGetsendresultRequest(); OapiMessageCorpconversationGetsendresultRequest req = new OapiMessageCorpconversationGetsendresultRequest();
req.setAgentId(Long.valueOf(account.getAgentId())); req.setAgentId(Long.valueOf(account.getAgentId()));
req.setTaskId(456L); req.setTaskId(456L);
OapiMessageCorpconversationGetsendresultResponse rsp = client.execute(req, accessToken); client.execute(req, accessToken);
} catch (Exception e) { } catch (Exception e) {
log.error("DingDingWorkNoticeHandler#pull fail:{}", Throwables.getStackTraceAsString(e)); log.error("DingDingWorkNoticeHandler#pull fail:{}", Throwables.getStackTraceAsString(e));
} }

@ -13,7 +13,7 @@ import java.util.Date;
* @author 3y * @author 3y
*/ */
public class TaskInfoUtils { public class TaskInfoUtils {
private static final int TYPE_FLAG = 1000000; private static final long TYPE_FLAG = 1000000L;
private static final String CODE = "track_code_bid"; private static final String CODE = "track_code_bid";
private TaskInfoUtils() { private TaskInfoUtils() {
} }
@ -34,7 +34,7 @@ public class TaskInfoUtils {
*/ */
public static Long generateBusinessId(Long templateId, Integer templateType) { public static Long generateBusinessId(Long templateId, Integer templateType) {
Integer today = Integer.valueOf(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN)); Integer today = Integer.valueOf(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN));
return Long.valueOf(String.format("%d%s", templateType * TYPE_FLAG + templateId, today)); return Long.valueOf(String.format("%d%s", templateType.longValue() * TYPE_FLAG + templateId, today));
} }
/** /**

Loading…
Cancel
Save