Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-1046

Business Object returns null due to Shadow Fact, unless declared final

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.0.MR3, 4.0.0.GA
    • Fix Version/s: 4.0.1
    • Component/s: drools-core (expert)
    • Labels:
      None
    • Environment:

      Windows, X86 based machine

      Description

      SCENARIO
      -----------------
      Define an Object 'BooleanConfiguration'

      public class BooleanConfiguration extends BusinessObject {
      String paramName; //with setter and getter
      Boolean value; //with setter and getter
      Client client; //with setter and getter – Client is an object that composes of String clientId;
      }

      *BusinessObject is just a generic Object that maintains a reference to the Assertion List from where it came (Ref. to the container object, Collection).

      Action(s):
      -------------
      1. initialize the object with a Parameter and Value (Hard code to test) – Set
      2. Execute against a Rule:
      When
      config: BooleanConfiguration(value==true)
      Then
      //Do something
      end

      EXECUTION NOTES:
      -------------------------------
      1. I asserted this object and the rule was not executing as I expected.
      2. I put a break point in the object, and found that it set it correctly but
      whenenver the rule engine called the get method the vaue of the object was null.

      3. I traced this the place where it creates shadows in Rete.java.
      I had observed a similar behaviour in version 3.1 or 3.6 (if there was a 3.6).
      it was more prolific then.

      4. I made the class 'final' (This prevents a shadow from being created), and voila
      my rule worked as expected.
      Note: None of the other objects needed a final, but had comeplex associations.
      But this particular object does not run, unless declared final.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tirelli Edson Tirelli
                Reporter:
                ArjunDhar Arjun Dhar
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: