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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Verified (View Workflow)
    • Major
    • Resolution: Done
    • 7.9.0.GA
    • 7.10.1.GA
    • BRE
    • The issue was found in RHDM 7.9.0.

    • CR1
    • 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.
    • 1
    • 2020 Week 52-03 (from Dec 21), 2021 Week 04-06 (from Jan 25), 2021 Week 07-09 (from Feb 15)
    • +

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: