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 9e0d408b90..f959de72b8 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 @@ -182,8 +182,12 @@ public abstract class JiraAbstractClient extends BaseClient { } public void auth() { + ResponseEntity response = null; try { - restTemplate.exchange(getBaseUrl() + "/myself", HttpMethod.GET, getAuthHttpEntity(), String.class); + response = restTemplate.exchange(getBaseUrl() + "/myself", HttpMethod.GET, getAuthHttpEntity(), String.class); + if (StringUtils.isNotBlank(response.getBody()) && !response.getBody().startsWith("{\"self\"")) { + MSException.throwException(Translator.get("jira_auth_url_error")); + } } catch (HttpClientErrorException e) { if (e.getRawStatusCode() == 401) { MSException.throwException(Translator.get("jira_auth_error")); diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 5e233ef985..2361c9d14d 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -321,3 +321,4 @@ error_code_is_unique=Error code is not unique no_version_exists=version not exists jira_auth_error=Account name or password (Token) is wrong +jira_auth_url_error=The test connection failed, please check whether the Jira address is correct \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 8bf9aa85ab..8831c26a76 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -319,3 +319,4 @@ issue_jira_info_error=请检查服务集成信息或Jira项目ID error_code_is_unique=错误代码不可重复 no_version_exists=不存在版本!请先创建项目的版本 jira_auth_error=账号名或密码(Token)错误 +jira_auth_url_error=测试连接失败,请检查Jira地址是否正确 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 883f4291e3..4ef4deb1c3 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -319,3 +319,4 @@ error_code_is_unique=錯誤代碼不可重複 no_version_exists=不存在版本!請先創建項目的版本 jira_auth_error=賬號名或密碼(Token)錯誤 +jira_auth_url_error=測試連接失敗,請檢查Jira地址是否正確 \ No newline at end of file