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

ClassCastException in mvel when updating a List property with modify

    Details

    • Type: Bug
    • Status: Verified (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 7.4.1.GA
    • Fix Version/s: 7.5.0.GA
    • Component/s: BRE
    • Labels:
    • Target Release:
    • Fix Build:
      CR1
    • Sprint:
      2019 Week 35-37
    • QE Test Coverage:
      +

      Description

      The following code in the RHS of a rule fails with mvel dialect:

      +                "    modify($p) { addresses.add(address) }\n" +
      +                "    //$p.getAddresses().add(address); update($p);\n" +
      

      Exception:

      Exception executing consequence for rule "addAddress" in defaultpkg: java.lang.ClassCastException: org.mvel2.optimizers.impl.refl.nodes.GetterAccessor cannot be cast to org.mvel2.optimizers.impl.refl.nodes.MethodAccessor
      	at org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
      	at org.drools.core.common.DefaultAgenda.handleException(DefaultAgenda.java:1242)
      	at org.drools.core.phreak.RuleExecutor.innerFireActivation(RuleExecutor.java:439)
      	at org.drools.core.phreak.RuleExecutor.fireActivation(RuleExecutor.java:380)
      	at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:136)
      	at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:89)
      	at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:34)
      	at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
      	at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1062)
      	at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1009)
      	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1001)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1330)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1321)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1305)
      	at org.drools.compiler.integrationtests.Misc2Test.testModifyAddToList(Misc2Test.java:9139)
      

      Notes:

      • The same rule worked in Drools 6.5.x
      • The alternative syntax (commented out in the snippet above) works

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mfusco Mario Fusco
                  Reporter:
                  mputz Martin Weiler
                  Tester:
                  Daniel Rosa
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: