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

NullPointerException in LogicTransformer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.Beta1
    • 6.4.0.Final
    • core engine
    • None
    • Hide

      Compile a KieContainer containing the following .drl script:

      import org.drools.core.BeliefSystemType
      
      declare TestThing end
      
      query TestQuery(BeliefSystemType enumVal)
        TestThing()
      end
      
      query NPEQuery(TestThing thing)
        (
          TestQuery(BeliefSystemType.SIMPLE;)
        ) or (
          TestQuery(BeliefSystemType.SIMPLE;)
        )
      end
      
      Show
      Compile a KieContainer containing the following .drl script: import org.drools.core.BeliefSystemType declare TestThing end query TestQuery(BeliefSystemType enumVal) TestThing() end query NPEQuery(TestThing thing) ( TestQuery(BeliefSystemType.SIMPLE;) ) or ( TestQuery(BeliefSystemType.SIMPLE;) ) end
    • NEW
    • NEW

      When an enum constant is used in the context of an or-operator as a positional argument to a query, a NullPointerException is thrown with the following stack trace:

      java.lang.NullPointerException
      	at org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:230)
      	at org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:251)
      	at org.drools.core.rule.LogicTransformer.fixClonedDeclarations(LogicTransformer.java:154)
      	at org.drools.core.rule.LogicTransformer.transform(LogicTransformer.java:97)
      	at org.drools.core.definitions.rule.impl.RuleImpl.getTransformedLhs(RuleImpl.java:620)
      	at org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:108)
      	at org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:106)
      	at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1567)
      	at org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1547)
      	at org.drools.core.impl.KnowledgeBaseImpl.internalAddPackages(KnowledgeBaseImpl.java:920)
      	at org.drools.core.impl.KnowledgeBaseImpl.access$000(KnowledgeBaseImpl.java:117)
      	at org.drools.core.impl.KnowledgeBaseImpl$1.run(KnowledgeBaseImpl.java:708)
      	at org.drools.core.impl.KnowledgeBaseImpl.enqueueModification(KnowledgeBaseImpl.java:716)
      	at org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:705)
      	at org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:273)
      	at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:510)
      	at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:447)
      ...
      

              mfusco@redhat.com Mario Fusco
              scranen Sjoerd Cranen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: