tbel: rollback validation switch

This commit is contained in:
nick 2023-08-01 14:56:50 +03:00
parent 581c02bf6b
commit 698dfba952
3 changed files with 3 additions and 15 deletions

View File

@ -66,8 +66,6 @@ public class DefaultTbelInvokeService extends AbstractScriptInvokeService implem
protected final Map<UUID, String> scriptIdToHash = new ConcurrentHashMap<>(); protected final Map<UUID, String> scriptIdToHash = new ConcurrentHashMap<>();
protected final Map<String, TbelScript> scriptMap = new ConcurrentHashMap<>(); protected final Map<String, TbelScript> scriptMap = new ConcurrentHashMap<>();
private final String tbelSwitch = "switch";
private final String tbelSwitchErrorMsg = "TBEL does not support the 'switch'.";
protected Cache<String, Serializable> compiledScriptsCache; protected Cache<String, Serializable> compiledScriptsCache;
private SandboxedParserConfiguration parserConfig; private SandboxedParserConfiguration parserConfig;
@ -183,11 +181,6 @@ public class DefaultTbelInvokeService extends AbstractScriptInvokeService implem
lock.unlock(); lock.unlock();
} }
return scriptId; 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) { } catch (Exception e) {
throw new TbScriptException(scriptId, TbScriptException.ErrorCode.COMPILATION, scriptBody, e); throw new TbScriptException(scriptId, TbScriptException.ErrorCode.COMPILATION, scriptBody, e);
} }

View File

@ -78,7 +78,7 @@
<zookeeper.version>3.8.1</zookeeper.version> <zookeeper.version>3.8.1</zookeeper.version>
<protobuf.version>3.21.9</protobuf.version> <protobuf.version>3.21.9</protobuf.version>
<grpc.version>1.42.1</grpc.version> <grpc.version>1.42.1</grpc.version>
<tbel.version>1.0.6</tbel.version> <tbel.version>1.0.7</tbel.version>
<lombok.version>1.18.18</lombok.version> <lombok.version>1.18.18</lombok.version>
<paho.client.version>1.2.4</paho.client.version> <paho.client.version>1.2.4</paho.client.version>
<paho.mqttv5.client.version>1.2.5</paho.mqttv5.client.version> <paho.mqttv5.client.version>1.2.5</paho.mqttv5.client.version>

View File

@ -5229,10 +5229,6 @@ var JSHINT = (function() {
var a = [], p; var a = [], p;
while (!state.tokens.next.reach && state.tokens.next.id !== "(end)") { 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 === ";") { if (state.tokens.next.id === ";") {
p = peek(); p = peek();
@ -9219,7 +9215,7 @@ var JSHINT = (function() {
statements(0); statements(0);
} }
if (state.tokens.next.id !== "(end)"&& state.tokens.next.value !== "switch") { if (state.tokens.next.id !== "(end)") {
quit("E041", state.tokens.curr); quit("E041", state.tokens.curr);
} }
@ -11270,8 +11266,7 @@ var errors = {
E064: "Super call may only be used within class method bodies.", 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 " + E065: "Functions defined outside of strict mode with non-simple parameter lists may not " +
"enable strict mode.", "enable strict mode.",
E066: "Asynchronous iteration is only available with for-of loops.", 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."
}; };
var warnings = { var warnings = {