droolsjbpm/drools — pull request #170 by magnusvojbacke (2012-12-22 15:39:36+00:00)
Title: Fixing issue where indented keywords would fail template expansion.

Issue description
==============
In template files, whitespaces before keywords would cause exceptions.

Example of indented "template" keyword
--------------------------------------------------------

``` 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)

Example of 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)

Patch description
==============

* Altered the DefaultTemplateContainer.java to trim lines before comparison.
* Added simple unit-test to expose bug / confirm patch