diff --git a/backend/src/main/java/io/metersphere/track/issue/client/JiraAbstractClient.java b/backend/src/main/java/io/metersphere/track/issue/client/JiraAbstractClient.java index 44073a1e6f..6b8fc1acc1 100644 --- a/backend/src/main/java/io/metersphere/track/issue/client/JiraAbstractClient.java +++ b/backend/src/main/java/io/metersphere/track/issue/client/JiraAbstractClient.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.i18n.Translator; import io.metersphere.track.issue.domain.jira.*; import org.apache.commons.lang3.StringUtils; import org.springframework.core.io.FileSystemResource; @@ -35,14 +36,19 @@ public abstract class JiraAbstractClient extends BaseClient { public Map getCreateMetadata(String projectKey, String issueType) { String url = getBaseUrl() + "/issue/createmeta?projectKeys={1}&issuetypeNames={2}&expand=projects.issuetypes.fields"; ResponseEntity response = null; + Map fields = null; try { response = restTemplate.exchange(url, HttpMethod.GET, getAuthHttpEntity(), String.class, projectKey, issueType); } catch (Exception e) { LogUtil.error(e.getMessage(), e); MSException.throwException(e.getMessage()); } - Map fields = ((JiraCreateMetadataResponse) getResultForObject(JiraCreateMetadataResponse.class, response)) - .getProjects().get(0).getIssuetypes().get(0).getFields(); + try { + fields = ((JiraCreateMetadataResponse) getResultForObject(JiraCreateMetadataResponse.class, response)) + .getProjects().get(0).getIssuetypes().get(0).getFields(); + } catch (Exception e) { + MSException.throwException(Translator.get("issue_jira_info_error")); + } fields.remove("project"); fields.remove("issuetype"); return fields; diff --git a/backend/src/main/resources/i18n/messages.properties b/backend/src/main/resources/i18n/messages.properties index 00b7868732..53e19b8c5c 100644 --- a/backend/src/main/resources/i18n/messages.properties +++ b/backend/src/main/resources/i18n/messages.properties @@ -73,3 +73,4 @@ mock_warning= invalid_parameter= workspace_template_settings_issue= zentao_test_type_error= +issue_jira_info_error= diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 4d400e9cf4..041d3e3886 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -292,3 +292,4 @@ enterprise_test_report=Enterprise report null_environment_group_name = Environment group name is null environment_group_name = Environment group name environment_group_exist = already exists +issue_jira_info_error=Check the service integration information or Jira project ID diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 5e09e3f76d..f4e4486a5f 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -290,4 +290,5 @@ enterprise_test_report=项目报告 #环境组 null_environment_group_name = 环境组名称不存在 environment_group_name = 环境组名称 -environment_group_exist = 已存在 \ No newline at end of file +environment_group_exist = 已存在 +issue_jira_info_error=请检查服务集成信息或Jira项目ID diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index b7f0e41ea0..b062c13a18 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -290,4 +290,5 @@ enterprise_test_report=項目報告 #环境组 null_environment_group_name = 環境組名稱不存在 environment_group_name = 環境組名稱 -environment_group_exist = 已存在 \ No newline at end of file +environment_group_exist = 已存在 +issue_jira_info_error=請檢查服務集成信息或Jira項目ID