From 68543a2ca50192de6148a5c8173b95b77169bb04 Mon Sep 17 00:00:00 2001 From: bryan31 Date: Sun, 25 Oct 2020 23:52:14 +0800 Subject: [PATCH] =?UTF-8?q?enhancement:=20#I1X83D=20=E6=8F=90=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E4=BC=98=E5=8C=96=EF=BC=9Aflow.xml=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=EF=BC=8C=E7=BC=96=E6=8E=92=E7=9A=84?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=89=BE=E4=B8=8D=E5=88=B0=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=89=93=E5=8D=B0=E5=87=BA=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E6=89=BE=E5=87=BA=E5=93=AA=E4=B8=AA?= =?UTF-8?q?=E8=8A=82=E7=82=B9=EF=BC=8C=E5=A5=BD=E5=AE=9A=E4=BD=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yomahub/liteflow/parser/XmlFlowParser.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java index 138c82c46..4ebcf0537 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java @@ -7,8 +7,10 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; +import cn.hutool.core.util.StrUtil; import com.yomahub.liteflow.entity.flow.*; import com.yomahub.liteflow.exception.ExecutableItemNotFoundException; +import com.yomahub.liteflow.util.SpringAware; import org.apache.commons.lang3.StringUtils; import org.dom4j.Document; import org.dom4j.Element; @@ -44,13 +46,15 @@ public abstract class XmlFlowParser { String clazz = null; Node node = null; NodeComponent component = null; + Class nodeComponentClass; for (Element e : nodeList) { node = new Node(); id = e.attributeValue("id"); clazz = e.attributeValue("class"); node.setId(id); node.setClazz(clazz); - component = (NodeComponent) Class.forName(clazz).newInstance(); + nodeComponentClass = (Class)Class.forName(clazz); + component = SpringAware.registerOrGet(nodeComponentClass); if (component == null) { LOG.error("couldn't find component class [{}] ", clazz); } @@ -72,7 +76,7 @@ public abstract class XmlFlowParser { parseOneChain(e); } } catch (Exception e) { - LOG.error("FlowParser parser exception: {}", e); + LOG.error("FlowParser parser exception", e); throw e; } } @@ -118,7 +122,8 @@ public abstract class XmlFlowParser { Chain chain = FlowBus.getChain(item); chainNodeList.add(chain); }else{ - throw new ExecutableItemNotFoundException(); + String errorMsg = StrUtil.format("executable node[{}] is not found!",regexEntity.getItem()); + throw new ExecutableItemNotFoundException(errorMsg); } } if (condE.getName().equals("then")) {