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

"NoSuchElementException: No value present" with executable-model, Map and binding

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.16.0.Final
    • executable model
    • 2019 Week 05-07
    • 3
      • See unit test PR
    • NEW
    • NEW

      When compiling a below rule with executable-model:

      rule R1
        when
          $p : Person()
          $a : Address(number == $p.items[1])
        then
      end
      

      it fails with the following error:

      [ERROR] Tests run: 165, Failures: 0, Errors: 2, Skipped: 3, Time elapsed: 20.794 s <<< FAILURE! - in org.drools.modelcompiler.CompilerTest
      [ERROR] testMapWithBinding[FLOW_DSL](org.drools.modelcompiler.CompilerTest)  Time elapsed: 0.02 s  <<< ERROR!
      java.util.NoSuchElementException: No value present
      	at java.util.Optional.get(Optional.java:135)
      	at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.toTypedExpressionFromMethodCallOrField(ExpressionTyper.java:397)
      	at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.toTypedExpressionRec(ExpressionTyper.java:211)
      	at org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper.toTypedExpression(ExpressionTyper.java:108)
      	at org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser.parseBinaryExpr(ConstraintParser.java:295)
      	at org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser.getDrlxParseResult(ConstraintParser.java:111)
      	at org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser.drlxParse(ConstraintParser.java:78)
      	at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSL.findAllConstraint(PatternDSL.java:124)
      	at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSL.buildPattern(PatternDSL.java:191)
      	at org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor.visit(ModelGeneratorVisitor.java:128)
      	at org.drools.compiler.lang.descr.PatternDescr.accept(PatternDescr.java:267)
      	at org.drools.modelcompiler.builder.generator.visitor.AndVisitor.visit(AndVisitor.java:29)
      	at org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor.visit(ModelGeneratorVisitor.java:69)
      	at org.drools.modelcompiler.builder.generator.ModelGenerator.processRule(ModelGenerator.java:174)
      	at org.drools.modelcompiler.builder.generator.ModelGenerator.generateModel(ModelGenerator.java:154)
      	at org.drools.modelcompiler.builder.ModelBuilderImpl.compileKnowledgePackages(ModelBuilderImpl.java:144)
      	at org.drools.modelcompiler.builder.ModelBuilderImpl.buildRules(ModelBuilderImpl.java:94)
      	at org.drools.modelcompiler.builder.ModelBuilderImpl.buildPackages(ModelBuilderImpl.java:63)
      	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:108)
      	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:100)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:257)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:74)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:267)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:235)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:204)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:192)
      	at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:142)
      	at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:125)
      	at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:114)
      	at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:107)
      	at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:103)
      	at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:99)
      	at org.drools.modelcompiler.CompilerTest.testMapWithBinding(CompilerTest.java:1457)
      	...
      

              lmolteni@redhat.com Luca Molteni
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: