Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-165

Fail-fast mode when a global is not defined at session start

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Minor Minor
    • 5.5.1.Final, 6.0.0.Beta4
    • 6.0.0.Beta3
    • None
    • None

      The following DRL causes an infinite loop when run without setting the "missing" global:

      global java.util.Collection missing
      dialect "mvel"

      rule "toInfinityAndBeyond"
      when
      then
      x = missing[3]
      end

      because it triggers https://jira.codehaus.org/browse/MVEL-290

      Even though the core issue is in MVEL I would really like an option to fail fast when a global is undefined at the very start of a session. I don't know about others but I never define globals from within the rules and I've had all sorts of trouble with missing globals - the infinite loop was just the last straw.

      Of course, a global may legitimately be defined as null (which would also trigger the MVEL bug). So perhaps the fail-fast mode could be enabled on a case-by-case basis:

      global required java.util.Collection basicHelpers

      Sorry if this has been suggested before, I couldn't find any pertinent discussions.

            mfusco@redhat.com Mario Fusco
            codingjourney_jira Jan Hustak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: