fix(接口测试): dubbo获取providers报空指针异常

--bug=1014354 --user=陈建星 [接口测试]github#13776获取dubbo列表每次去拉取provider数据太慢,并且有脏数据会导致空指针异常 https://www.tapd.cn/55049933/s/1190706
This commit is contained in:
chenjianxing 2022-06-27 15:43:31 +08:00 committed by jianxing
parent c81ab30964
commit 35a8ef33bb
1 changed files with 8 additions and 3 deletions

View File

@ -387,9 +387,14 @@ public class APITestService {
provider.setService(p);
provider.setServiceInterface(info[0]);
Map<String, URL> services = providerService.findByService(p);
if (services != null && !services.isEmpty()) {
String[] methods = services.values().stream().findFirst().get().getParameter(CommonConstants.METHODS_KEY).split(",");
provider.setMethods(Arrays.asList(methods));
if (services != null && !services.isEmpty() && !CollectionUtils.isEmpty(services.values())) {
String parameter = services.values().stream().findFirst().get().getParameter(CommonConstants.METHODS_KEY);
if (StringUtils.isNotBlank(parameter)) {
String[] methods = parameter.split(",");
provider.setMethods(Arrays.asList(methods));
} else {
provider.setMethods(new ArrayList<>());
}
} else {
provider.setMethods(new ArrayList<>());
}