1. Mule
  2. MULE-5496

ScriptExpressionEvaluator does not throw Exception


    • User impact:
    • Similar Issues:
      MULE-2764Webapp example throws SAXParseException: Content is not allowed in prolog.
      MULE-6608MEL does not provide root exceptions
      MULE-8660Commit failure does not trigger exception strategy
      MULE-5513CXF proxy does not propagate root cause of an exception.
      MULE-6631Throw Exceptions from Flow
      MULE-4610ObjectToJMSMessage throws Exception when payload is List of Maps
      MULE-2990Mule File Connector does not throw an exception while polling a directory if the directory is unreadable.
      MULE-5559HttpsConnector fails to throw exception on missing key store
      MULE-246Mule does not return Exceptions through Soap endpoints
      MULE-4630Configured Service Exception strategy does not get called for MessageRedeliveredException


      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
                           #[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();
              script.populateBindings(bindings, message);
                  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?


        Ari Ruotsalainen created issue -
        Mike Schilling made changes -
        Field Original Value New Value
        Priority To be reviewed [ 6 ] Critical [ 2 ]
        Pablo Kraan made changes -
        Assignee Pablo Kraan [ pablo.kraan ]
        Pablo Kraan added a comment - Fix 3.1.x Fix 3.2.x Fix 3.x
        Pablo Kraan made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 3.1.4 [ 11079 ]
        Fix Version/s 3.2.2 [ 11105 ]
        Resolution Fixed [ 1 ]
        Ramiro Rinaudo made changes -
        Workflow Fixed Main Mule Workflow (after JIRA upgrade) [ 81242 ] Main Mule Workflow v1.0 [ 140094 ]
        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


          • Assignee:
            Pablo Kraan
            Ari Ruotsalainen
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: