diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java index 781c48c502..80e8a19e58 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java @@ -39,7 +39,7 @@ public class Swagger2Parser extends SwaggerAbstractParser { if (StringUtils.isNotBlank(request.getSwaggerUrl())) { try { // 使用 url 导入 swagger - swagger = new SwaggerParser().read(request.getSwaggerUrl(), auths, true); + swagger = new SwaggerParser().read(request.getSwaggerUrl(), auths, false); } catch (Exception e) { LoggerUtil.error(e); MSException.throwException(e.getMessage()); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java index 14144aa7ef..f08a76faf9 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java @@ -26,6 +26,7 @@ import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.LogUtil; import io.metersphere.constants.RunModeConstants; +import io.metersphere.i18n.Translator; import io.metersphere.jmeter.utils.ScriptEngineUtils; import io.metersphere.plugin.core.MsParameter; import io.metersphere.plugin.core.MsTestElement; @@ -113,9 +114,11 @@ public class ElementUtil { csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName()); csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding()); - if (CollectionUtils.isNotEmpty(item.getFiles())) { + if (CollectionUtils.isEmpty(item.getFiles())) { + MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]"); + } else { if (!config.isOperating() && !new File(BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()).exists()) { - MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ CSV文件不存在 ]"); + MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ " + Translator.get("csv_no_exist") + " ]"); } csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()); } diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 22758d980b..6c94c125b2 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -409,3 +409,4 @@ ui_element_already_exists_data=An element with the same name already exists serial=Serial parallel=Parallel plan_warning=The test plan does not have an associated executable use case +csv_no_exist=CSV file does not exist diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 93bed0842e..464b4de49c 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -408,3 +408,4 @@ ui_element_already_exists_data=已经存在同名元素 serial=串行 parallel=并行 plan_warning=测试计划没有关联可执行的用例 +csv_no_exist=CSV文件不存在 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 341349e58b..079e1c7c0a 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -407,3 +407,4 @@ ui_element_already_exists_data=已經存在同名元素 serial=串行 parallel=並行 plan_warning=測試計劃沒有關聯可執行的用例 +csv_no_exist=CSV檔案不存在