You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Michael Osipov (JIRA)" <ji...@apache.org> on 2019/04/23 13:51:00 UTC
[jira] [Commented] (VELOCITY-914) Empty String content returned for
String values containing "#*"
[ https://issues.apache.org/jira/browse/VELOCITY-914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824153#comment-16824153 ]
Michael Osipov commented on VELOCITY-914:
-----------------------------------------
Try with 2.0 first.
> 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-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org