Hi, I had a quick look, we make extensive use of String.startsWith(...) to parse the template. Indenting stuff isn't going to help that - unless we change to trim the String first.
Everybody is busy something crazy refactoring the world for 6.0... I suspect it's unlikely any of the core team will fix this anytime soon.. it could be the perfect opportunity for you to submit a simple Pull Request with the fix. With kind regards, Mike On 13 December 2012 15:56, magnusv <[email protected]> wrote: > Drools 5.5.0 > > Indenting the "template header" or "rule" keywords in a template file will > cause exceptions on expansion. I believe it might be related to this old > JIRA issue: https://issues.jboss.org/browse/JBRULES-2786 > > "DecisionTableParseException" and "NullPointerException" are thrown. See > example code and related stack traces below. > > > Is this a bug in drools or is the template formatting intended to be this > strict? Or am I doing something else wrong? > > > ===================== > Indented template header: > " template header > age > type > log" > > Gives the exception: > org.drools.template.parser.DecisionTableParseException: Missing header > at > > org.drools.template.parser.DefaultTemplateContainer.parseTemplate(DefaultTemplateContainer.java:87) > at > > org.drools.template.parser.DefaultTemplateContainer.<init>(DefaultTemplateContainer.java:47) > at > > org.drools.decisiontable.ExternalSpreadsheetCompiler.compile(ExternalSpreadsheetCompiler.java:97) > > ===================== > Indented rule keyword: > > " rule "Cheese fans_@{row.rowNumber}" > when > Person(age == @{age})" > > Gives the exception: > java.lang.NullPointerException > at > > org.drools.template.parser.DefaultTemplateColumn.createCellCondition(DefaultTemplateColumn.java:67) > at > > org.drools.template.parser.DefaultTemplateColumn.addCondition(DefaultTemplateColumn.java:90) > at > > org.drools.template.parser.DefaultTemplateRuleBase.createColumnConditions(DefaultTemplateRuleBase.java:103) > at > > org.drools.template.parser.DefaultTemplateRuleBase.createTemplateRule(DefaultTemplateRuleBase.java:96) > at > > org.drools.template.parser.DefaultTemplateRuleBase.getDTRules(DefaultTemplateRuleBase.java:83) > at > > org.drools.template.parser.DefaultTemplateRuleBase.<init>(DefaultTemplateRuleBase.java:62) > at > > org.drools.template.parser.TemplateDataListener.<init>(TemplateDataListener.java:74) > at > > org.drools.decisiontable.ExternalSpreadsheetCompiler.compile(ExternalSpreadsheetCompiler.java:99) > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Why-are-indented-keywords-in-template-causing-NPE-or-DecisionTableParseException-tp4021193.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
