[ 
https://issues.apache.org/jira/browse/VELOCITY-914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claude Brisson closed VELOCITY-914.
-----------------------------------

> 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
>    Affects Versions: 2.1
>            Reporter: Savio Fernandes
>            Assignee: Claude Brisson
>            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
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to