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

Binding variable of non-boolean unary expression fails to build when connected with && in executable-model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • None
    • executable model
    • None

      Constraints below fails with exec-model while non-exec-model can execute. Actually non-exec-model doesn't evaluate such an unary expression $n : name so it is equivalent to true. Note that non-exec-model transforms ExprConstraintDescr into ConstraintConnectiveDescr so "&&" is treated like ",".

      $p : Person($n : name && age > 20)
      

      Error:

      java.lang.AssertionError: A reference was unexpectedly null.
      	at com.github.javaparser.utils.Utils.assertNotNull(Utils.java:47)
      	at com.github.javaparser.ast.expr.BinaryExpr.setLeft(BinaryExpr.java:166)
      	at com.github.javaparser.ast.expr.BinaryExpr.<init>(BinaryExpr.java:131)
      	at com.github.javaparser.ast.expr.BinaryExpr.<init>(BinaryExpr.java:122)
      	at org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess.combineWith(SingleDrlxParseSuccess.java:417)
      	at org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser.parseBinaryExpr(ConstraintParser.java:529)
      	at org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser.compileToJavaRecursive(ConstraintParser.java:234)
      	at org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser.compileStart(ConstraintParser.java:193)
      	at org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser.drlxParse(ConstraintParser.java:144)
      	at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSL.findAllConstraint(PatternDSL.java:147)
      	at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSL.buildPattern(PatternDSL.java:306)
      	at org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor.visit(ModelGeneratorVisitor.java:139)
      	at org.drools.compiler.lang.descr.PatternDescr.accept(PatternDescr.java:303)
      	at org.drools.modelcompiler.builder.generator.visitor.AndVisitor.visit(AndVisitor.java:51)
      	at org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor.visit(ModelGeneratorVisitor.java:80)
      	at org.drools.modelcompiler.builder.generator.ModelGenerator.processRule(ModelGenerator.java:212)
      	at org.drools.modelcompiler.builder.generator.ModelGenerator.processRuleDescr(ModelGenerator.java:177)
      	at org.drools.modelcompiler.builder.generator.ModelGenerator.generateModel(ModelGenerator.java:166)
      	at org.drools.modelcompiler.builder.ModelBuilderImpl.compileKnowledgePackages(ModelBuilderImpl.java:270)
      	at org.drools.modelcompiler.builder.ModelBuilderImpl.buildRules(ModelBuilderImpl.java:206)
      	at org.drools.modelcompiler.builder.ModelBuilderImpl.doSecondBuildStep(ModelBuilderImpl.java:117)
      	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:115)
      	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:99)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:270)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:216)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:80)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:277)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:245)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:202)
      	at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:147)
      	at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:130)
      	at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:119)
      	at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:112)
      	at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:108)
      	at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:104)
      	at org.drools.modelcompiler.BindingTest.testBindingOnNonBooleanUnaryLeft(BindingTest.java:308)
      

      Similar case (boolean unary expression) was discussed in RHDM-1612

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

                Created:
                Updated:
                Resolved: