Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4791

SimpleTemplateEngine class has side effects

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.7.10
    • None
    • Templating
    • None
    • Groovy 1.7.10, MacOS X 10.6.7

    Description

      Consider the following code snippet

      import groovy.text.*
      
      def map1 = [key1: 'value1', key2: 'value2']
      
      def template = 
      """BEGIN TEMPLATE 
      key1: <%=key1%>key2: <%=key2%>
      END TEMPLATE"""
      
      def w = new SimpleTemplateEngine().createTemplate(template).make(map1).toString()
      map1
      

      Youget the following result:

      Result: [key1:value1, key2:value2, out:java.io.PrintWriter@a4aad7f]
      

      SimpleTemplateEngine class adds an odd element 'out' to the supplied map variable.

      Attachments

        Activity

          People

            Unassigned Unassigned
            os Oleh Sklyarenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: