Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1944

Equality condition between BigDecimal property and numeric value does not work correctly in non executable model.

    XMLWordPrintable

Details

    • False
    • None
    • False
    • Release Notes
    • CR1
    • +
    • Hide
      $ unzip reproducer_bd_equal_1d.zip
      $ cd reproducer_bd_equal_1d
      $ ./run_mvn
      === non-executable model ===
          :
          :
      ***** start
      ***** end    <---------- Rule 1 does not match
          :
          :
      
      === executable model ===
          :
          :
      ***** start
      ***** Action of Rule 1: $fact = com.example.reproducer.Fact[value=10]
      ***** end
          :
          :
      
      Show
      $ unzip reproducer_bd_equal_1d.zip $ cd reproducer_bd_equal_1d $ ./run_mvn === non-executable model === : : ***** start ***** end <---------- Rule 1 does not match : : === executable model === : : ***** start ***** Action of Rule 1: $fact = com.example.reproducer.Fact[value=10] ***** end : :
    • 2022 Week 44-46 (from Oct 31)

    Description

      In non executable model, equality condition between BigDecimal property and numeric value does not work correctly when there are 3 or more different conditions for the same property.

      For example, when we insert an object which has BigDecimal("10") as value property for rules like (*1), Rule 1 does not match in non executable model.
      When the constraint in Rule 1 is value == 10B or value == new BigDecimal("10"), the issue does not occur.

      (*1) Example rules

      rule "Rule 1"
          when
              $fact : Fact( value == 10 )
          then
              System.out.println("***** Action of " + kcontext.getRule().getName() + ": $fact = " + $fact);
      end
      
      rule "Rule 2"
          when
              $fact : Fact( value == 20 )
          then
              System.out.println("***** Action of " + kcontext.getRule().getName() + ": $fact = " + $fact);
      end
      
      rule "Rule 3"
          when
              $fact : Fact( value == 30 )
          then
              System.out.println("***** Action of " + kcontext.getRule().getName() + ": $fact = " + $fact);
      end
      

      (*2) Java code

      Fact fact = new Fact();
      fact.setValue(new BigDecimal("10"));
      kSession.insert(fact);
      
      System.out.println("***** start");
      kSession.fireAllRules();
      System.out.println("***** end");
      

      Attachments

        Issue Links

          Activity

            People

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-myoshida Masato Yoshida
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: