From 698dfba952ecf9430bd5a43dc104f851b37001d6 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 1 Aug 2023 14:56:50 +0300 Subject: [PATCH] tbel: rollback validation switch --- .../script/api/tbel/DefaultTbelInvokeService.java | 7 ------- pom.xml | 2 +- ui-ngx/src/app/shared/models/ace/tbel/worker-tbel.js | 9 ++------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java index bbf441a659..2a60980f84 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/DefaultTbelInvokeService.java @@ -66,8 +66,6 @@ public class DefaultTbelInvokeService extends AbstractScriptInvokeService implem protected final Map scriptIdToHash = new ConcurrentHashMap<>(); protected final Map scriptMap = new ConcurrentHashMap<>(); - private final String tbelSwitch = "switch"; - private final String tbelSwitchErrorMsg = "TBEL does not support the 'switch'."; protected Cache compiledScriptsCache; private SandboxedParserConfiguration parserConfig; @@ -183,11 +181,6 @@ public class DefaultTbelInvokeService extends AbstractScriptInvokeService implem lock.unlock(); } return scriptId; - } catch (CompileException ce) { - if ( ce.getExpr() != null && new String(ce.getExpr()).contains(tbelSwitch)) { - ce = new CompileException(tbelSwitchErrorMsg, ce.getExpr(), ce.getCursor(), ce.getCause()); - } - throw new TbScriptException(scriptId, TbScriptException.ErrorCode.COMPILATION, scriptBody, ce); } catch (Exception e) { throw new TbScriptException(scriptId, TbScriptException.ErrorCode.COMPILATION, scriptBody, e); } diff --git a/pom.xml b/pom.xml index 59d1eff5d3..df8c6ed8d6 100755 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ 3.8.1 3.21.9 1.42.1 - 1.0.6 + 1.0.7 1.18.18 1.2.4 1.2.5 diff --git a/ui-ngx/src/app/shared/models/ace/tbel/worker-tbel.js b/ui-ngx/src/app/shared/models/ace/tbel/worker-tbel.js index 3a4b3d90b8..d1d47d0c75 100644 --- a/ui-ngx/src/app/shared/models/ace/tbel/worker-tbel.js +++ b/ui-ngx/src/app/shared/models/ace/tbel/worker-tbel.js @@ -5229,10 +5229,6 @@ var JSHINT = (function() { var a = [], p; while (!state.tokens.next.reach && state.tokens.next.id !== "(end)") { - if (state.tokens.next.value === "switch") { - warning("E067", state.tokens.next, "switch"); - break; - } if (state.tokens.next.id === ";") { p = peek(); @@ -9219,7 +9215,7 @@ var JSHINT = (function() { statements(0); } - if (state.tokens.next.id !== "(end)"&& state.tokens.next.value !== "switch") { + if (state.tokens.next.id !== "(end)") { quit("E041", state.tokens.curr); } @@ -11270,8 +11266,7 @@ var errors = { E064: "Super call may only be used within class method bodies.", E065: "Functions defined outside of strict mode with non-simple parameter lists may not " + "enable strict mode.", - E066: "Asynchronous iteration is only available with for-of loops.", - E067: "Expected an 'if/else' and instead saw 'switch'. TBEL does not support the 'switch' statement." + E066: "Asynchronous iteration is only available with for-of loops." }; var warnings = {