Given an enum Fruit { CHERRY, STRAWBERRY } a rule with a typo in an enum name
Jam( fruit == Fruit.CHERIE || == Fruit.STRAWBERRY,... )
causes the NPE shown below while adding the DRL resource:
Exception in thread "main" java.lang.NullPointerException
at
org.drools.rule.AbstractCompositeRestriction.getRequiredDeclarations(AbstractCompositeRestriction.java:59)
at
org.drools.rule.MultiRestrictionFieldConstraint.getRequiredDeclarations(MultiRestrictionFieldConstraint.java:73)
at org.drools.rule.Pattern.setConstraintType(Pattern.java:358)
at org.drools.rule.Pattern.addConstraint(Pattern.java:226)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:432)
at org.drools.rule.builder.PatternBuilder.buildConstraint(PatternBuilder.java:264)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:213)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:108)
at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:69)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:79)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1151)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:637)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:267)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:459)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at rss.checker.engine.impl.DroolsEngine.loadSourceRules(DroolsEngine.java:49)
at rss.checker.init.Main.exec(Main.java:36)
at rss.checker.init.Main.main(Main.java:63)