You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2019/06/08 13:22:00 UTC
[jira] [Resolved] (JEXL-306) Ternary operator ? protects also its
branches from resolvance errors
[ https://issues.apache.org/jira/browse/JEXL-306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Biestro resolved JEXL-306.
--------------------------------
Resolution: Fixed
Changeset: 041fcaf0b32e1316c578f971039e1632a01f8f79
Author: Henri Biestro <hb...@gmail.com>
Date: 2019-06-08 15:18
Message: JEXL-306: ensure ternary expressions only protect the condition part against variable resolution failure
> Ternary operator ? protects also its branches from resolvance errors
> --------------------------------------------------------------------
>
> Key: JEXL-306
> URL: https://issues.apache.org/jira/browse/JEXL-306
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 3.1
> Reporter: Dmitri Blinov
> Priority: Major
>
> Consider the following test case (suppose its added to IfTest)
> {code:java}
> @Test
> public void testTernaryFail() throws Exception {
> JexlEvalContext jc = new JexlEvalContext();
> JexlExpression e = JEXL.createExpression("false ? bar : quux");
> Object o;
> jc.setStrict(true);
> jc.setSilent(false);
> try {
> o = e.evaluate(jc);
> Assert.fail("Should have failed");
> } catch (Exception ex) {
> // OK
> }
> }
> {code}
> The expected behavior is to fail with {{undefined variable...}} because neither {{bar}} nor {{quux}} is defined
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)