From 0270b507e2ea2f175d20a1f4edcf0f3718f1e377 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 25 May 2022 18:36:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8C=E6=AD=A5=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1013369 --user=陈建星 【测试跟踪】集成第三方平台tapd/zentao,输入错误的项目id ,缺陷管理同步缺陷会报错,建议有友好提示 https://www.tapd.cn/55049933/s/1164111 --- .../io/metersphere/track/issue/client/TapdClient.java | 8 +++++++- .../io/metersphere/track/issue/client/ZentaoClient.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/issue/client/TapdClient.java b/backend/src/main/java/io/metersphere/track/issue/client/TapdClient.java index b467b5ddaf..742170e697 100644 --- a/backend/src/main/java/io/metersphere/track/issue/client/TapdClient.java +++ b/backend/src/main/java/io/metersphere/track/issue/client/TapdClient.java @@ -36,7 +36,13 @@ public class TapdClient extends BaseClient { public Map getStatusMap(String projectId) { String url = getBaseUrl() + "/workflows/status_map?workspace_id={1}&system=bug"; - ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectId); + ResponseEntity response = null; + try { + response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectId); + } catch (Exception e) { + MSException.throwException("请检查配置信息是否填写正确!"); + LogUtil.error(e); + } String resultForObject = (String) getResultForObject(String.class, response); JSONObject jsonObject = JSONObject.parseObject(resultForObject); String data = jsonObject.getString("data"); diff --git a/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java b/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java index 7a29f2936b..5345181014 100644 --- a/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java +++ b/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java @@ -157,7 +157,13 @@ public abstract class ZentaoClient extends BaseClient { String sessionId = login(); ResponseEntity response = restTemplate.exchange(requestUrl.getBugList(), HttpMethod.GET, null, String.class, projectId, 9999999, pageSize, pageNum, sessionId); - return JSONObject.parseObject(response.getBody()).getJSONObject("data").getJSONArray("bugs"); + try { + return JSONObject.parseObject(response.getBody()).getJSONObject("data").getJSONArray("bugs"); + } catch (Exception e) { + LogUtil.error(e); + MSException.throwException("请检查配置信息是否填写正确!"); + } + return null; } public String getBaseUrl() {