Let's assume that I wanted to do some logic in groovy expression when inserting data to database. I have following jdbc-endpoint query configuration:
<jdbc:connector name="foo-connector" dataSource-ref="foo-ds">
value=" INSERT INTO FOO
#[groovy:throw new RuntimeException('field2 gets inserted with null instead of error in JdbcMessageDispatcher')])" />
For simpler example I omitted the actual logic by throwing an Exception intentionally.
When I call the endpoint, no Exception is thrown to Mule. Only null value is inserted in the database. I think it is very dangerous if an Exception is not thrown when evaluating an expression. Now corrupted data may be added to database.
I think the cause is in
public Object evaluate(String expression, MuleMessage message)
Scriptable script = getScript(expression);
Bindings bindings = script.getScriptEngine().createBindings();
catch (ScriptException e)
The ScriptException is omitted brutally. Could the exception be propagated so I would sleep better at nights?