Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-207

Inconsistent error handling

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

      I can't figure out what is the logic behind current implementation of script interruptablity/error handling.

      For example the following script will execute up to the end and return 42 in any mode (strict/silent)

      x = null.1; return 42
      

      whereas the following script will break with exception "bean is null" also in any mode (strict/silent)

      null.1 = 2; return 42
      

      and the following script will throw an exception in strict mode regardless of being silent/non-silent

      z = [1,2]; x = z[3]; return 42
      

      The documentation states that

      The strict flag tells the engine when and if null as operand is considered an error, the silent flag tells the engine what to do with the error (log as warning or throw exception)

      From the first example we see that null is not considered as error when we resolve bean property value, even does not log a message, while it might be expected in strict mode. From the second example we see that null is always considered as an error when we set bean property value, but is never ignored (always breaks script execution), even in silent mode. From the third example we see that AIOOBE is also considered as an error that breaks script execution in strict mode, regardless of silent/non-silent mode.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                henrib Henri Biestro
                Reporter:
                dmitri_blinov Dmitri Blinov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: