From a3a59b298fc2d0d4dcad699f95a3d1ea9d14cf60 Mon Sep 17 00:00:00 2001 From: dialYun <1552333077@qq.com> Date: Sun, 18 Aug 2024 14:02:05 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0getTagAction=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=BF=94=E5=9B=9Enull=E5=80=BC=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dialYun <1552333077@qq.com> --- .../src/main/java/io/nop/xlang/api/XLang.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java b/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java index 1cebf28d5..41a251e16 100644 --- a/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java +++ b/nop-xlang/src/main/java/io/nop/xlang/api/XLang.java @@ -79,16 +79,24 @@ public static XplModel loadTpl(String path) { return (XplModel) ResourceComponentManager.instance().loadComponentModel(path); } - public static AbstractEvalAction getTagAction(String libPath, String tagName) { + public static AbstractEvalAction getTagAction(String libPath, String tagName, boolean isException) { IXplTagLib lib = (IXplTagLib) ResourceComponentManager.instance().loadComponentModel(libPath); IXplTag tag = lib.getTag(tagName); - if (tag == null) - throw new NopException(ERR_XLIB_UNKNOWN_TAG).param(ARG_LIB_PATH, libPath).param(ARG_TAG_NAME, tagName); + if (tag == null) { + if (isException) { + throw new NopException(ERR_XLIB_UNKNOWN_TAG).param(ARG_LIB_PATH, libPath).param(ARG_TAG_NAME, tagName); + } + return null; + } IFunctionModel func = tag.getFunctionModel(); return new ExecutableFunctionEvalAction(func); } + public static AbstractEvalAction getTagAction(String libPath, String tagName) { + return getTagAction(libPath, tagName, true); + } + public static IXplTag getTag(String libPath, String tagName) { IXplTagLib lib = (IXplTagLib) ResourceComponentManager.instance().loadComponentModel(libPath); IXplTag tag = lib.getTag(tagName);