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

CCE modifying a polymorphic object over a window

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.CR1
    • None
    • core engine
    • None
    • NEW
    • NEW

      Modifying an object matched in a polymorphic way and using a window like in this test case:

          @Test
          public void testModifySubclassOverWindow() {
              // DROOLS-
              String drl = "declare Number @role( event ) end\n" +
                           "declare Integer @role( event ) end\n" +
                           "\n" +
                           "rule R1 no-loop when\n" +
                           "    $i: Integer()\n" +
                           "then\n" +
                           "    update($i);\n" +
                           "end\n" +
                           "rule R2 when\n" +
                           "    $n: Number() over window:length(1)\n" +
                           "then\n" +
                           "end";
      
              KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL )
                                                   .build( EventProcessingOption.STREAM )
                                                   .newKieSession();
              ksession.insert(1);
              ksession.fireAllRules();
          }
      

      causes a CCE like the following:

      java.lang.ClassCastException: org.drools.core.reteoo.WindowNode cannot be cast to org.drools.core.reteoo.BetaNode
      
      	at org.drools.core.reteoo.EntryPointNode.removeRightTuplesMatchingOTN(EntryPointNode.java:263)
      	at org.drools.core.reteoo.EntryPointNode.propagateModify(EntryPointNode.java:253)
      	at org.drools.core.reteoo.EntryPointNode.propagateModify(EntryPointNode.java:245)
      	at org.drools.core.phreak.PropagationEntry$Update.execute(PropagationEntry.java:217)
      	at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:93)
      	at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:83)
      	at org.drools.core.common.DefaultAgenda.flushPropagations(DefaultAgenda.java:1275)
      	at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:143)
      	at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:89)
      	at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:37)
      	at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
      	at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1074)
      	at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1021)
      	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1013)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1315)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1306)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1290)
      	at org.drools.compiler.integrationtests.PolymorphismTest.testModifySubclassOverWindow(PolymorphismTest.java:50)
      

              mfusco@redhat.com Mario Fusco
              mfusco@redhat.com Mario Fusco
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: