[
https://issues.apache.org/jira/browse/VELOCITY-914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Savio Fernandes updated VELOCITY-914:
-------------------------------------
Description:
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.
was:
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.
> 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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]