From 34bf64ce7379a778dea43b063c58b955ae800837 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 7 Sep 2020 11:38:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=8E=B7=E5=8F=96jira=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E6=97=B6=E5=87=BA=E7=8E=B0=E7=A9=BA=E6=8C=87=E9=92=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/track/service/IssuesService.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/IssuesService.java b/backend/src/main/java/io/metersphere/track/service/IssuesService.java index 76e55cf953..d57d482ef0 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -346,10 +346,19 @@ public class IssuesService { String body = responseEntity.getBody(); JSONObject obj = JSONObject.parseObject(body); + LogUtil.info(obj); + + String lastmodify = ""; + String status = ""; + JSONObject fields = (JSONObject) obj.get("fields"); JSONObject statusObj = (JSONObject) fields.get("status"); JSONObject assignee = (JSONObject) fields.get("assignee"); - JSONObject statusCategory = (JSONObject) statusObj.get("statusCategory"); + + if (statusObj != null) { + JSONObject statusCategory = (JSONObject) statusObj.get("statusCategory"); + status = statusCategory.getString("key"); + } String id = obj.getString("id"); String title = fields.getString("summary"); @@ -360,9 +369,8 @@ public class IssuesService { HtmlRenderer renderer = HtmlRenderer.builder().build(); description = renderer.render(document); - String status = statusCategory.getString("key"); Long createTime = fields.getLong("created"); - String lastmodify = ""; + if (assignee != null) { lastmodify = assignee.getString("displayName"); } From 5eb9a5aadde5a287faa3650340152cf70f683be7 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Tue, 8 Sep 2020 15:23:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E7=94=A8=E4=BE=8Bnull?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/track/service/TestCaseService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 c6a582c095..04b62c4225 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -386,7 +386,13 @@ public class TestCaseService { data.setPrerequisite(t.getPrerequisite()); if (t.getMethod().equals("manual")) { String steps = t.getSteps(); - JSONArray jsonArray = JSON.parseArray(steps); + String setp = ""; + if (steps.contains("null")) { + setp = steps.replace("null", ""); + } else { + setp = steps; + } + 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");