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

SimpleTemplateEngine and Backslash

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.5.4, 1.5.5, 1.5.6, 1.6-beta-1
    • None
    • Groovlet / GSP
    • None
    • Patch

    Description

      groovy.text.SimpleTemplateEngine doesn't handle backslashes correctly. Trying to parse the following template creates an error:
      asd\asd

      The bug can be reproduced with the following Groovy Snippet (can be copy & pasted into the GroovyConsole):

      new groovy.text.SimpleTemplateEngine().createTemplate(new StringReader("asd\\asd"));
      

      A possible fix for this would probably need to go here:

      http://fisheye.codehaus.org/browse/groovy/trunk/groovy/groovy-core/src/main/groovy/text/SimpleTemplateEngine.java?r=10222#l177

      Something like the following would need to be added there I think:

      if (c == '\\') {
        sw.write("\\\\");
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ttest ttest
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: