Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E2C919153 for ; Tue, 22 Mar 2016 17:05:26 +0000 (UTC) Received: (qmail 11495 invoked by uid 500); 22 Mar 2016 17:05:26 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 11328 invoked by uid 500); 22 Mar 2016 17:05:26 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 11228 invoked by uid 99); 22 Mar 2016 17:05:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Mar 2016 17:05:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 9592F2C1F61 for ; Tue, 22 Mar 2016 17:05:25 +0000 (UTC) Date: Tue, 22 Mar 2016 17:05:25 +0000 (UTC) From: "Henri Biestro (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (JEXL-159) Difference in handling between Jexl expression evaluation and LazyDynaMap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/JEXL-159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Biestro updated JEXL-159: ------------------------------- Fix Version/s: (was: 3.0.1) 3.1 > Difference in handling between Jexl expression evaluation and LazyDynaMap > ------------------------------------------------------------------------- > > Key: JEXL-159 > URL: https://issues.apache.org/jira/browse/JEXL-159 > Project: Commons JEXL > Issue Type: Bug > Affects Versions: 2.1.1 > Reporter: Mike Day > Fix For: 3.1 > > > LazyDynaMap seems to support a full stop in the attribute name, but the Jexl expression evaluation expects this to signify a nested object. > The second test below fails, even though the first assertion is correct. Please can you take a look? > {code} > public class JexlTest { > @Test > public void testUnderscoreInName() { > JexlEngine jexl = new JexlEngine(); > String jexlExp = "(x.length_mm * x.width)"; > Expression e = jexl.createExpression( jexlExp ); > JexlContext jc = new MapContext(); > LazyDynaMap object = new LazyDynaMap(); > object.set("length_mm", "10.0"); > object.set("width", "5.0"); > jc.set("x", object ); > assertEquals(null, ((Double)e.evaluate(jc)).doubleValue(), 50d, 0d); > } > @Test > public void testFullStopInName() { > JexlEngine jexl = new JexlEngine(); > String jexlExp = "(x.length.mm * x.width)"; > Expression e = jexl.createExpression( jexlExp ); > JexlContext jc = new MapContext(); > LazyDynaMap object = new LazyDynaMap(); > object.set("length.mm", "10.0"); > object.set("width", "5.0"); > > assertEquals(null, object.get("length.mm"), "10.0"); > jc.set("x", object ); > assertEquals(null, ((Double)e.evaluate(jc)).doubleValue(), 50d, 0d); > } > > @Test > public void testFullStopInNameMakingSubObject() { > JexlEngine jexl = new JexlEngine(); > String jexlExp = "(x.length.mm * x.width)"; > Expression e = jexl.createExpression( jexlExp ); > JexlContext jc = new MapContext(); > LazyDynaMap object = new LazyDynaMap(); > LazyDynaMap subObject = new LazyDynaMap(); > object.set("length", subObject); > subObject.set("mm", "10.0"); > object.set("width", "5.0"); > > jc.set("x", object ); > assertEquals(null, ((Double)e.evaluate(jc)).doubleValue(), 50d, 0d); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)