From 457ee06b872c393b4f00a686c7fb4e49bd484940 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 15 May 2020 17:49:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=AF=BC=E5=85=A5=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=BA=E7=A9=BA=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excel/listener/TestCaseDataListener.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java index db35ee8269..c9df3b95e2 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java @@ -39,16 +39,17 @@ public class TestCaseDataListener extends EasyExcelListener { public String validate(TestCaseExcelData data, String errMsg) { String nodePath = data.getNodePath(); StringBuilder stringBuilder = new StringBuilder(errMsg); - String[] nodes = nodePath.split("/"); - if ( nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) { - stringBuilder.append("节点最多为" + TestCaseConstants.MAX_NODE_DEPTH + "层;"); - } - - for (int i = 0; i < nodes.length; i++) { - if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) { - stringBuilder.append("所属模块不能为空格"); - break; + if (nodePath != null) { + String[] nodes = nodePath.split("/"); + if ( nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) { + stringBuilder.append("节点最多为" + TestCaseConstants.MAX_NODE_DEPTH + "层;"); + } + for (int i = 0; i < nodes.length; i++) { + if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) { + stringBuilder.append("所属模块不能为空格"); + break; + } } }