From 4472c320bd2cf10233f1889737b1894a4f52cece Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Thu, 21 Jul 2022 11:33:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=9C=AA=E6=89=A7=E8=A1=8C=E7=9A=84case=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84=E7=BC=BA=E9=99=B7=20(#15998)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015053 --user=王孝刚 【测试跟踪】测试计划-执行测试计划时选择失败重试&失败停止-报告中点击接口case中未执行的用例报500error https://www.tapd.cn/55049933/s/1205319 Co-authored-by: wxg0103 <727495428@qq.com> --- .../api/service/ApiDefinitionService.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index b63bcf3834..0c4ada0fdd 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -1498,13 +1498,17 @@ public class ApiDefinitionService { } APIReportResult reportResult = new APIReportResult(); reportResult.setStatus(result.getStatus()); - if (StringUtils.isNotEmpty(result.getEnvConfig())) { + String contentStr = result.getContent(); + try { JSONObject content = JSONObject.parseObject(result.getContent()); - content.put("envName", this.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig())); - reportResult.setContent(content.toJSONString()); - } else { - reportResult.setContent(result.getContent()); + if (StringUtils.isNotEmpty(result.getEnvConfig())) { + content.put("envName", this.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig())); + } + contentStr = content.toString(); + } catch (Exception e) { + LogUtil.error("解析content失败!", e); } + reportResult.setContent(contentStr); return reportResult; }