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

KieBase build fails with forall patterns containing "not equal" constraints

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.33.0.Final
    • core engine
    • None
    • 2020 Week 10-12 (from Mar 2)
    • Hide

      run

      mvn clean test
      

      on attached reproducer.

      Show
      run mvn clean test on attached reproducer.
    • NEW
    • NEW

      as of Drools 7.33.0.Final, forall patterns with "not equal" (!=) constraints will break when building the KieBase.

      For example the following DRL:

          rule "forall with not equal"
          when forall(String(this != "foo"))
          then
          end
      

      generates the following error:

          java.lang.StringIndexOutOfBoundsException: String index out of range: -1
          
          	at java.lang.String.substring(String.java:1967)
          	at org.drools.core.rule.constraint.MvelConstraint.getLeftInExpression(MvelConstraint.java:608)
          	at org.drools.core.rule.constraint.MvelConstraint.hashCode(MvelConstraint.java:602)
          	at org.drools.core.reteoo.AlphaNode.calculateHashCode(AlphaNode.java:189)
          	at org.drools.core.reteoo.AlphaNode.<init>(AlphaNode.java:89)
          	at org.drools.core.reteoo.builder.PhreakNodeFactory.buildAlphaNode(PhreakNodeFactory.java:88)
          	at org.drools.core.reteoo.builder.PatternBuilder.buildAlphaNodeChain(PatternBuilder.java:360)
          	at org.drools.core.reteoo.builder.PatternBuilder.attachAlphaNodes(PatternBuilder.java:346)
          	at org.drools.core.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:136)
          	at org.drools.core.reteoo.builder.PatternBuilder.build(PatternBuilder.java:84)
          	at org.drools.core.reteoo.builder.GroupElementBuilder$NotBuilder.build(GroupElementBuilder.java:220)
          	at org.drools.core.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:68)
          	at org.drools.core.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:108)
          	at org.drools.core.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:68)
          	at org.drools.core.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:167)
          	at org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:139)
          	at org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:110)
          	at org.drools.core.impl.KnowledgeBaseImpl.internalAddRule(KnowledgeBaseImpl.java:1525)
          	at org.drools.core.impl.KnowledgeBaseImpl.internalAddPackages(KnowledgeBaseImpl.java:926)
          	at org.drools.core.impl.KnowledgeBaseImpl.lambda$addPackages$2(KnowledgeBaseImpl.java:728)
          	at org.drools.core.impl.KnowledgeBaseImpl.enqueueModification(KnowledgeBaseImpl.java:745)
          	at org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:728)
          	at org.drools.compiler.kie.builder.impl.AbstractKieModule.createKieBase(AbstractKieModule.java:226)
          	at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:407)
          	at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:375)
      

      This is working fine when using Drools <= 7.32.0.Final.

              mfusco@redhat.com Mario Fusco
              mcasalino Matteo Casalino (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: