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

ambika updated VELOCITY-955:
----------------------------
    Description: 
*script used :* 

 
Map<String, Object> variables = new HashMap<>();
variables.put("key1", "value");
 
Context context = velocityEngine.getToolsContext(variables);
 
String inString = "#set($value = \"key value false\")" +
"#if(${key1} == 1 ||\"yes\" )" +
" #set($value = \"{*}{{*}}key value true{{*}}{*}\")" +
"#end\n${value}";
 
inString = velocityEngine.evaluate(context, "tag", inString);
System.out.println(inString);
 
 
Output:
 
older version output : key value true
 
newer version output : key value false 
 
 
 

  was:
*script used :* 

 
Map<String, Object> variables = new HashMap<>();
variables.put("key1", "value");
 
Context context = velocityEngine.getToolsContext(variables);
 
String inString = "#set($value = \"key value false\")" +
"#if(${key1} == 1 ||\"yes\" )" +
" #set($value = \"*{*}key value true{*}*\")" +
"#end\n${value}";
 
inString = velocityManager.evaluate(context, "tag", inString);
System.out.println(inString);
 
 
Output:
 
older version output : key value true
 
newer version output : key value false 
 
 
 


> velocity 1.7 vs velocity 2.3 : the evaluation of if condition in script is 
> different 
> -------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-955
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-955
>             Project: Velocity
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: 2.3
>            Reporter: ambika
>            Priority: Major
>
> *script used :* 
>  
> Map<String, Object> variables = new HashMap<>();
> variables.put("key1", "value");
>  
> Context context = velocityEngine.getToolsContext(variables);
>  
> String inString = "#set($value = \"key value false\")" +
> "#if(${key1} == 1 ||\"yes\" )" +
> " #set($value = \"{*}{{*}}key value true{{*}}{*}\")" +
> "#end\n${value}";
>  
> inString = velocityEngine.evaluate(context, "tag", inString);
> System.out.println(inString);
>  
>  
> Output:
>  
> older version output : key value true
>  
> newer version output : key value false 
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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

Reply via email to