You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Chase (Jira)" <ji...@apache.org> on 2020/04/15 01:32:00 UTC

[jira] [Created] (GROOVY-9507) JSP style loop in StreamingTemplateEngine template results in TemplateParseException

Christopher Chase created GROOVY-9507:
-----------------------------------------

             Summary: JSP style loop in StreamingTemplateEngine template results in TemplateParseException
                 Key: GROOVY-9507
                 URL: https://issues.apache.org/jira/browse/GROOVY-9507
             Project: Groovy
          Issue Type: Bug
          Components: Templating
    Affects Versions: 3.0.3
            Reporter: Christopher Chase


 

The example below works as expected when run in Groovy 2.5.8, yet it fails when run in Groovy 3.0.3

 

 
{code:java}
TemplateEngine engine = new StreamingTemplateEngine()

Template template = engine.createTemplate('''
<ul>
    <% items.each { %>
    <li>${it}</li>
    <% } %>
</ul>
''')

println template.make([items : [1,2,3,4]])
{code}
 

Expected output (and the output 2.5.8 yields):

 
{noformat}
<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
</ul>{noformat}
 

Exception:

 
{noformat}
Exception in thread "main" groovy.text.TemplateParseException: Template parse error 'Unexpected input: '{'; Expecting RBRACE ' at line 3, column 27
         2:         <ul>
     --> 3:             <% items.each { %>
         4:             <li>${it}</li>{noformat}
 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)