Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3134

Parenthesized class name causes NPE in RuleBuilder (MVEL)

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Done
    • 5.2.0.Final
    • 5.3.0.Final
    • None
    • None

    Description

      declare Foo
      clazz : Class
      end
      rule testFoo
      when
      Foo( clazz == (java.lang.Object) )
      then
      System.out.println( "Foo is Object" );
      end

      causes

      Exception in thread "main" [Error: not a statement, or badly formed structure]
      [Near :

      {... (java.lang.Object) ....}

      ]
      ^
      [Line: 1, Column: 19]
      at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:307)
      at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:69)
      at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
      at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
      at org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:779)
      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:540)
      at org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:349)
      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:264)
      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:122)
      at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
      at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:81)
      at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1889)
      at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:755)
      at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:365)
      at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:543)
      at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
      at listofthree.Main.setup(Main.java:55)
      at listofthree.Main.main(Main.java:107)
      Caused by: java.lang.NullPointerException
      at java.lang.Class.isAssignableFrom(Native Method)
      at org.mvel2.DataConversion.canConvert(DataConversion.java:104)
      at org.mvel2.ast.TypeCast.<init>(TypeCast.java:47)
      at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1034)
      at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:135)
      ... 17 more

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            laune Wolfgang Laun (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: