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

Negative rule condition does not work correctly starting from version 7.35.0.Final

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 7.35.0.Final, 7.36.0.Final, 7.37.0.Final, 7.38.0.Final, 7.39.0.Final, 7.40.0.Final, 7.41.0.Final, 7.42.0.Final, 7.43.0.Final, 7.43.1.Final, 7.44.0.Final, 7.45.0.Final
    • core engine
    • None
    • 2020 Week 46-48 (from Nov 9)
    • Hide

      There is a sample Springboot Maven project attached (demo.zip), which implements scenario, described below. If Springboot application developed is executed as it is (with <org.kie>7.34.0.Final</org.kie> property in pom.xml) - there is no messages in the logs, everything works correctly (it was tested as well for the versions down to 7.17.Final). If version in pom.xml is changed to >= 7.35.0.Final, then rule 2 will be executed - you will be able to see corresponding message in the logs (which is not a correct behaviour).

      Show
      There is a sample Springboot Maven project attached ( demo.zip ), which implements scenario, described below. If Springboot application developed is executed as it is (with  <org.kie>7.34.0.Final</org.kie> property in pom.xml ) - there is no messages in the logs, everything works correctly (it was tested as well for the versions down to 7.17.Final). If version in pom.xml is changed to >= 7.35.0.Final , then rule 2 will be executed - you will be able to see corresponding message in the logs (which is not a correct behaviour).
    • Undefined
    • NEW
    • NEW
    • ---
    • ---

    Description

      Let's consider next rules example:

       

      declare Input1  
        value : int
      end
      
      declare Input2
        value : int
      end
      
      rule "Init Rule" 
      lock-on-active    
      when    
      then
        Input1 input1 = new Input1();
        Input2 input2 = new Input2();
        input1.setValue(5);
        input2.setValue(10);
        insert(input1);
        insert(input2);
      end
      
      rule "Run Rule"
      when
        $input1: Input1()
        $input2: Input2(
          !($input1.value <= value)
        )
      then
        System.out.println("Errorneous rule execution!!!");
      

       

      In this code:

      • 2 inputs are created and initialized by the first rule.
      • The second rule must fire only when condition !($input1.value <= value) evaluates to true.
      • According to the values set, condition !($input1.value <= value) evaluates always to false, so second rule should never been executed.

      But if this rule is tested with Drools version >= 7.35.0.Final, this rule is executed (it is possible to see a message in the logs). With lower Drools versions - everything works correctly.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            alexey.nesterenko Alexey Nesterenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: