[ https://issues.apache.org/jira/browse/VELOCITY-914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824434#comment-16824434 ]
Claude Brisson commented on VELOCITY-914: ----------------------------------------- As you may have noticed, the multiline comments format of Velocity is {{#* ... *#}}. As it stands today, the parser doesn't wait for the ending tag to start discarding tokens, and that's not easy to change. Which just mean that the {{#*}} character sequence will always start discarding what follows. And it's not a behavior that's easy to change. So what you need is a worakround. For instance, you can print : {{#$!sep*}} : since {{$sep}} doesn't exist in your context, it will be rendered as {{#*}}. > Empty String content returned for String values containing "#*" > --------------------------------------------------------------- > > Key: VELOCITY-914 > URL: https://issues.apache.org/jira/browse/VELOCITY-914 > Project: Velocity > Issue Type: Bug > Reporter: Savio Fernandes > Priority: Major > > We are using the following method to evaluate string content given a map of > tokens that are used in the localContext of the VelocityEngine. > > {noformat} > VelocityEngine :: public boolean evaluate( Context context, Writer out, > String logTag, String instring ){noformat} > > which populates the *out* Writer with the evaluated String value. > We have noticed that if the input String contains content similar to : > {noformat} > "<some content> #* <some other content>"{noformat} > The output of the evaluation becomes : > {noformat} > "<some content> "{noformat} > i.e. content after the "#*" part is ignored. > > Sample Unit test : > > {noformat} > @Test > public void testEmptyString() { > String input = "#* something"; > VelocityEngine velocityEngine = new VelocityEngine(); > ToolContext toolsContext = new ToolManager().createContext(); > toolsContext.put("key", "value"); > StringWriter writer = new StringWriter(); > velocityEngine.evaluate(toolsContext, writer, "logtag", input); > writer.flush(); > String output = writer.toString(); > Assert.assertTrue(output != null && output.trim().isEmpty()); > }{noformat} > > If the '#' character is not followed by '*' character, then the output String > is non-empty. > > Velocity Engine version : > 1.7 > -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org