[jira] [Commented] (VELTOOLS-210) velocity 1.7 vs velocity 2.3 : the evaluation of if condition in script is different
"Claude Brisson (Jira)" <[email protected]> Wed, 17 Jun 2026 14:37:00 +0000 (UTC)
| Newsgroups | gmane.comp.jakarta.velocity.devel |
|---|---|
| Message-ID | <[email protected]> |
[ https://issues.apache.org/jira/browse/VELTOOLS-210?page=3Dcom.atlassi=
an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D18=
089681#comment-18089681 ]=20
Claude Brisson commented on VELTOOLS-210:
-----------------------------------------
A test under 1.7 of the following template gave "key value false", so I cou=
ld not reproduce your issue.
{code:java}
#set($key1 =3D "value")#set($value =3D "key value false")
#if(${key1} =3D=3D 1 || "yes" )
=C2=A0 #set($value =3D "key value true")
#end
${value}
{code}
> velocity 1.7 vs velocity 2.3 : the evaluation of if condition in script i=
s different=20
> -------------------------------------------------------------------------=
------------
>
> Key: VELTOOLS-210
> URL: https://issues.apache.org/jira/browse/VELTOOLS-210
> Project: Velocity Tools
> Issue Type: Bug
> Components: VelocityView
> Affects Versions: 3.1
> Reporter: ambika
> Priority: Major
>
> *script used :*=C2=A0
> =C2=A0
> Map<String, Object> variables =3D new HashMap<>();
> variables.put("key1", "value");
> =C2=A0
> Context context =3D velocityEngine.getToolsContext(variables);
> =C2=A0
> String inString =3D "#set($value =3D \"key value false\")" +
> "#if(${key1} =3D=3D 1 ||\"yes\" )" +
> " #set($value =3D \"{*}{{*}}key value true{{*}}{*}\")" +
> "#end\n${value}";
> =C2=A0
> inString =3D velocityEngine.evaluate(context, "tag", inString);
> System.out.println(inString);
> =C2=A0
> =C2=A0
> Output:
> =C2=A0
> older version output : key value true
> =C2=A0
> newer version output : key value false=C2=A0
> =C2=A0
> =C2=A0
> =C2=A0
--
This message was sent by Atlassian Jira
(v8.20.10#820010)