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

compile error in exec model when comparing BigDecimal with String literal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.11.1.GA
    • 7.10.1.GA
    • BRE
    • Red Hat Decision Manager 7.10.1

    • False
    • False
    • CR1
    • +
    • Undefined
    • Hide

      Rewrte constraint either of the following.

      $fact : Fact( bd == 150)

      or
      $fact : Fact( $b : bd, $b == "150")

      Show
      Rewrte constraint either of the following. $fact : Fact( bd == 150) or $fact : Fact( $b : bd, $b == "150")
    • Hide

      run attached reproducer by 'mvn clean -X compile'.
      If run it by 'mvn clean compile exec:exec", build would work and rule is executed as expected.

      Show
      run attached reproducer by 'mvn clean -X compile'. If run it by 'mvn clean compile exec:exec", build would work and rule is executed as expected.
    • 2021 Week 19-21 (from May 10), 2021 Week 22-24 (from May 31)

      When comparing BigDecimal type property with String literal like the following.

              $fact : Fact( bd == "150")
      

      compile in executable model fails with java.lang.NumberFormatException like the following.

      Caused by: java.lang.NumberFormatException: Character " is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
          at java.math.BigDecimal.<init> (BigDecimal.java:518)
          at java.math.BigDecimal.<init> (BigDecimal.java:401)
          at java.math.BigDecimal.<init> (BigDecimal.java:834)
          at org.drools.modelcompiler.builder.generator.expression.AbstractExpressionBuilder.narrowExpressionToType (AbstractExpressionBuilder.java:273)
          at org.drools.modelcompiler.builder.generator.expression.PatternExpressionBuilder.buildIndexedBy (PatternExpressionBuilder.java:210)
          at org.drools.modelcompiler.builder.generator.expression.PatternExpressionBuilder.buildSingleExpressionWithIndexing (PatternExpressionBuilder.java:104)
          at org.drools.modelcompiler.builder.generator.expression.PatternExpressionBuilder.buildExpressionWithIndexing (PatternExpressionBuilder.java:92)
          at org.drools.modelcompiler.builder.generator.expression.PatternExpressionBuilder.processExpression (PatternExpressionBuilder.java:70)
          at org.drools.modelcompiler.builder.generator.expression.AbstractExpressionBuilder.processExpression (AbstractExpressionBuilder.java:85)
          at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSLSimpleConstraint.buildPattern (PatternDSLSimpleConstraint.java:45)
          at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSL$3.onSuccess (PatternDSL.java:215)
          at org.drools.modelcompiler.builder.generator.drlxparse.AbstractDrlxParseSuccess.accept (AbstractDrlxParseSuccess.java:46)
          at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSL.buildConstraint (PatternDSL.java:208)
          at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSLPattern.buildConstraints (PatternDSLPattern.java:100)
          at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSLPattern.buildPattern (PatternDSLPattern.java:53)
          at org.drools.modelcompiler.builder.generator.visitor.pattern.PatternDSL.buildPattern (PatternDSL.java:251)
          at org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor.visit (ModelGeneratorVisitor.java:145)
          at org.drools.compiler.lang.descr.PatternDescr.accept (PatternDescr.java:303)
          at org.drools.modelcompiler.builder.generator.visitor.AndVisitor.visit (AndVisitor.java:50)
          at org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor.visit (ModelGeneratorVisitor.java:86)
          at org.drools.modelcompiler.builder.generator.ModelGenerator.processRule (ModelGenerator.java:191)
          at org.drools.modelcompiler.builder.generator.ModelGenerator.generateModel (ModelGenerator.java:153)
          at org.drools.modelcompiler.builder.ModelBuilderImpl.compileKnowledgePackages (ModelBuilderImpl.java:274)
          at org.drools.modelcompiler.builder.ModelBuilderImpl.buildRules (ModelBuilderImpl.java:210)
          at org.drools.modelcompiler.builder.ModelBuilderImpl.doSecondBuildStep (ModelBuilderImpl.java:119)
          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:268)
          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.kie.maven.plugin.GenerateModelMojo.generateModel (GenerateModelMojo.java:144)
          at org.kie.maven.plugin.GenerateModelMojo.execute (GenerateModelMojo.java:104)
      

      This works with non-executable model.

              lmolteni@redhat.com Luca Molteni
              rhn-support-hmiura Hiroko Miura
              Paolo Bizzarri Paolo Bizzarri
              Paolo Bizzarri Paolo Bizzarri
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: