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

Compound assignment operation like BigDecimal_type_property <op> Numeric/BigDecimal_value causes an unexpected result or error in MVEL.

XMLWordPrintable

    • 2020 Week 52-03 (from Dec 21)
    • 4
    • Hide
      $ unzip reproducer_02801729_6_mvel.zip
      $ cd reproducer_02801729_6_mvel
      $ mvn clean compile test
          :
          :
      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running com.example.reproducer.CompoundAssignmentOperationsMVELTest
      testEV01BigDecimalTypePropertyOpNumericValue1: $bus.weight += 1000 ==> 1000
      testEV05BigDecimalTypePropertyOpBigDecimalValue1: $bus.weight += bdv ==> 1000
      testEX01BigDecimalTypePropertyOpNumericValue1: $bus.weight += 1000 ==> 13000
      testEX05BigDecimalTypePropertyOpBigDecimalValue1: $bus.weight += bdv ==> 13000
      
          :
          :
      
      Results :
      
      Failed tests:   testEV01BigDecimalTypePropertyOpNumericValue1(com.example.reproducer.CompoundAssignmentOperationsMVELTest): expected:<13000> but was:<1000>
        testEV05BigDecimalTypePropertyOpBigDecimalValue1(com.example.reproducer.CompoundAssignmentOperationsMVELTest): expected:<13000> but was:<1000>
      
      Tests in error: 
        testEV02BigDecimalTypePropertyOpNumericValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..)
        testEV03BigDecimalTypePropertyOpNumericValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..)
        testEV04BigDecimalTypePropertyOpNumericValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..)
        testEV06BigDecimalTypePropertyOpBigDecimalValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..)
        testEV07BigDecimalTypePropertyOpBigDecimalValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..)
        testEV08BigDecimalTypePropertyOpBigDecimalValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..)
        testEX02BigDecimalTypePropertyOpNumericValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4
        testEX03BigDecimalTypePropertyOpNumericValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4
        testEX04BigDecimalTypePropertyOpNumericValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4
        testEX06BigDecimalTypePropertyOpBigDecimalValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4
        testEX07BigDecimalTypePropertyOpBigDecimalValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4
        testEX08BigDecimalTypePropertyOpBigDecimalValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4
      
      Tests run: 16, Failures: 2, Errors: 12, Skipped: 0
      
          :
          :
      

      (*) testEV* methods use MVEL.eval and testEX* methods use MVEL.executeExpression.

      Show
      $ unzip reproducer_02801729_6_mvel.zip $ cd reproducer_02801729_6_mvel $ mvn clean compile test : : ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.example.reproducer.CompoundAssignmentOperationsMVELTest testEV01BigDecimalTypePropertyOpNumericValue1: $bus.weight += 1000 ==> 1000 testEV05BigDecimalTypePropertyOpBigDecimalValue1: $bus.weight += bdv ==> 1000 testEX01BigDecimalTypePropertyOpNumericValue1: $bus.weight += 1000 ==> 13000 testEX05BigDecimalTypePropertyOpBigDecimalValue1: $bus.weight += bdv ==> 13000 : : Results : Failed tests: testEV01BigDecimalTypePropertyOpNumericValue1(com.example.reproducer.CompoundAssignmentOperationsMVELTest): expected:<13000> but was:<1000> testEV05BigDecimalTypePropertyOpBigDecimalValue1(com.example.reproducer.CompoundAssignmentOperationsMVELTest): expected:<13000> but was:<1000> Tests in error: testEV02BigDecimalTypePropertyOpNumericValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..) testEV03BigDecimalTypePropertyOpNumericValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..) testEV04BigDecimalTypePropertyOpNumericValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..) testEV06BigDecimalTypePropertyOpBigDecimalValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..) testEV07BigDecimalTypePropertyOpBigDecimalValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..) testEV08BigDecimalTypePropertyOpBigDecimalValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): [Error: cannot bind to null context: $bus](..) testEX02BigDecimalTypePropertyOpNumericValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4 testEX03BigDecimalTypePropertyOpNumericValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4 testEX04BigDecimalTypePropertyOpNumericValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4 testEX06BigDecimalTypePropertyOpBigDecimalValue2(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4 testEX07BigDecimalTypePropertyOpBigDecimalValue3(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4 testEX08BigDecimalTypePropertyOpBigDecimalValue4(com.example.reproducer.CompoundAssignmentOperationsMVELTest): begin 0, end -1, length 4 Tests run: 16, Failures: 2, Errors: 12, Skipped: 0 : : (*) testEV* methods use MVEL.eval and testEX* methods use MVEL.executeExpression.
    • Undefined
    • NEW
    • NEW
    • ---
    • ---

      Compound assignment operation like BigDecimal_type_property <op> Numeric/BigDecimal_value causes an unexpected result or error in MVEL (org.mvel2).

      When using MVEL.eval method, the result of "+=" operation is incorrect, and "-=", "*=", "/=" operations result in an error.

      • BigDecimal_type_property <op> Numeric_value (Initial value of $bus.weight is 12000B)
        • $bus.weight += 1000 ==> 1000 // incorrect result
        • $bus.weight -= 1000 ==> Error
        • $bus.weight *= 1000 ==> Error
        • $bus.weight /= 1000 ==> Error
      • BigDecimal_type_property <op> BigDecimal_value (Initial value of $bus.weight and bdv are 12000B and 1000B respectively)
        • $bus.weight += bdv ==> 1000 // incorrect result
        • $bus.weight -= bdv ==> Error
        • $bus.weight *= bdv ==> Error
        • $bus.weight /= bdv ==> Error

      When using MVEL.executeExpression method, the result of "+=" operation is correct, while "-=", "*=", "/=" operations cause an error.

      • BigDecimal_type_property <op> Numeric_value (Initial value of $bus.weight is 12000B)
        • $bus.weight += 1000 ==> 13000 // correct
        • $bus.weight -= 1000 ==> Error
        • $bus.weight *= 1000 ==> Error
        • $bus.weight /= 1000 ==> Error
      • BigDecimal_type_property <op> BigDecimal_value (Initial value of $bus.weight and bdv are 12000B and 1000B respectively)
        • $bus.weight += bdv ==> 13000 // correct
        • $bus.weight -= bdv ==> Error
        • $bus.weight *= bdv ==> Error
        • $bus.weight /= bdv ==> Error

      $bus.weight is a BigDecimal type property.

      MVEL library should return correct result for any operations above.

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: