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

SimpleTemplateEngine and Backslash

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.5.4, 1.5.5, 1.5.6, 1.6-beta-1
    • Fix Version/s: None
    • Component/s: Groovlet / GSP
    • Labels:
      None
    • Flags:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: