JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-5496

ScriptExpressionEvaluator does not throw Exception

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 3.1.1
  • Fix Version/s: 3.1.4 (EE only), 3.2.2 (EE only)
  • Component/s: Core: Expressions
  • Labels:
    None
  • User impact:
    Medium
  • Similar Issues:
    None

Description

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">
  <jdbc:query key="insertFoos"
            value=" INSERT INTO FOO
                    (field1,
                     field2)
                    VALUES 
                    (#[groovy:payload.bar],
                     #[groovy:throw new RuntimeException('field2 gets inserted with null instead of error in JdbcMessageDispatcher')])" />
</jdbc:connector>

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

AbstractScriptExpressionEvaluator.java
public Object evaluate(String expression, MuleMessage message)
{
        Scriptable script = getScript(expression);
        script.setMuleContext(muleContext);
        Bindings bindings = script.getScriptEngine().createBindings();
        script.populateBindings(bindings, message);

        try
        {
            return script.runScript(bindings);
        }
        catch (ScriptException e)
        {
            return null;
        }
}

The ScriptException is omitted brutally. Could the exception be propagated so I would sleep better at nights?

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Transition Time In Source Status Execution Times Last Executer Last Execution Date
Open Open Closed Closed
302d 12h 34m 1 Pablo Kraan 20/Jan/12 02:21 PM

People

  • Assignee:
    Pablo Kraan
    Reporter:
    Ari Ruotsalainen
Vote (0)
Watch (0)

Dates

  • Created:
    24/Mar/11 02:46 AM
    Updated:
    20/Jan/12 02:21 PM
    Resolved:
    20/Jan/12 02:21 PM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.