From fcf879d06fc6a819b16b5fa4939a76d01164cf6b Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 6 Nov 2020 09:39:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=87=BA=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestCaseService.java | 17 ++++++++++++----- frontend/src/business/components/xpack | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 82c99bff35..ca463ab9b0 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -457,12 +457,19 @@ public class TestCaseService { if (t.getMethod().equals("manual")) { String steps = t.getSteps(); String setp = ""; - if (steps.contains("null") && !steps.contains("\"null\"")) { - setp = steps.replace("null", "\"\""); - } else { - setp = steps; + setp = steps; + JSONArray jsonArray = null; + + //解决旧版本保存用例导出报错 + try { + jsonArray = JSON.parseArray(setp); + } catch (Exception e) { + if (steps.contains("null") && !steps.contains("\"null\"")) { + setp = steps.replace("null", "\"\""); + jsonArray = JSON.parseArray(setp); + } } - JSONArray jsonArray = JSON.parseArray(setp); + for (int j = 0; j < jsonArray.size(); j++) { int num = j + 1; step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\n"); diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index b9091a47b1..eb237fb6bf 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit b9091a47b197faef77c72b134b7cf604fe3209f0 +Subproject commit eb237fb6bfeba8d99e4db52450ae92f3cdd4ea33