From f3dbe66b63674eded1fc85d41a70fc28c9694331 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 27 Jan 2022 16:58:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84Mock=E7=8E=AF=E5=A2=83=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=97=B6=E4=BC=9A=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复使用默认生成的Mock环境进行测试时会报错的缺陷 --- .../api/dto/definition/parse/JMeterScriptUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/JMeterScriptUtil.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/JMeterScriptUtil.java index 7e0eb98382..a07631c0e1 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/JMeterScriptUtil.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/JMeterScriptUtil.java @@ -74,17 +74,17 @@ public class JMeterScriptUtil { boolean globalPreScriptIsFilter = JMeterScriptUtil.isScriptFilter(preFilterProtocal, protocal); boolean globalPostScriptIsFilter = JMeterScriptUtil.isScriptFilter(postFilterProtocal, protocal); if (isAfterPrivateScript) { - if (isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && StringUtils.isNotEmpty(preProcessor.getScript())) { + if (isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) { addItemHashTree(preProcessor, samplerHashTree, config, environmentId); } - if (isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && StringUtils.isNotEmpty(postProcessor.getScript())) { + if (isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && postProcessor != null && StringUtils.isNotEmpty(postProcessor.getScript())) { addItemHashTree(postProcessor, samplerHashTree, config, environmentId); } } else { - if (!isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && StringUtils.isNotEmpty(preProcessor.getScript())) { + if (!isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) { addItemHashTree(preProcessor, samplerHashTree, config, environmentId); } - if (!isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && StringUtils.isNotEmpty(postProcessor.getScript())) { + if (!isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && postProcessor != null && StringUtils.isNotEmpty(postProcessor.getScript())) { addItemHashTree(postProcessor, samplerHashTree, config, environmentId); } }