From ea4911f7205bbd7ca53032616d21c5806daf610c Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Tue, 12 Mar 2024 10:59:47 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=8F=AF=E7=94=A8=E6=80=A7=E4=B8=8B=E6=A0=87?= =?UTF-8?q?=E8=B6=8A=E7=95=8C=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 测试账号可用性下标越界异常 --- .../resource/ResourceAccountAccessTestApi.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/neatlogic/module/cmdb/api/resourcecenter/resource/ResourceAccountAccessTestApi.java b/src/main/java/neatlogic/module/cmdb/api/resourcecenter/resource/ResourceAccountAccessTestApi.java index 7631fdcf..23c01da7 100644 --- a/src/main/java/neatlogic/module/cmdb/api/resourcecenter/resource/ResourceAccountAccessTestApi.java +++ b/src/main/java/neatlogic/module/cmdb/api/resourcecenter/resource/ResourceAccountAccessTestApi.java @@ -40,13 +40,13 @@ import neatlogic.framework.util.HttpRequestUtil; import neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceAccountMapper; import neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceMapper; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.Random; @Service @AuthAction(action = CMDB_BASE.class) @@ -109,7 +109,8 @@ public class ResourceAccountAccessTestApi extends PrivateApiComponentBase { throw new RunnerNotMatchException(); } // 随机分配runner - int runnerMapIndex = RandomUtils.nextInt() * runnerMapList.size(); +// int runnerMapIndex = RandomUtils.nextInt() * runnerMapList.size(); + int runnerMapIndex = new Random().nextInt(runnerMapList.size()); RunnerMapVo runnerMapVo = runnerMapList.get(runnerMapIndex); List accessTestVoList = new ArrayList<>(); List accountList = resourceAccountMapper.getAccountListByIdList(accountIdList); -- Gitee