Alex Hutton created JEXL-370:
--------------------------------
Summary: Cannot check if variable is defined using ObjectContext
if the value is null
Key: JEXL-370
URL: https://issues.apache.org/jira/browse/JEXL-370
Project: Commons JEXL
Issue Type: Bug
Affects Versions: 3.2.1
Reporter: Alex Hutton
Attachments: ObjectContextTest.java
I'm migrating from 3.1 to 3.2.1, and I've noticed the following change in
behaviour when using ObjectContext:
* Calling ObjectContext.has(String) for an object which has the given
property, but for which the current value is null, returns false, and not true
as it did before.
* Similarly, evaluating an expression which uses a property that is defined
but which is null, throws an ('is undefined') exception rather than returning
the null value.
The javadoc for JexlContext.has(String) says:
{quote}
A variable may be defined with a null value; this method checks whether the
value is null or if the variable is undefined.
{quote}
so my impression is that the behaviour of ObjectContext does not match what is
written in the Javadoc for the JexlContext interface. It is a problem in my
case because the 'undefined' exception causes quite a lot of confusion in use.
I've attached a test class to demonstrate the example. Please let me know if
any extra info is needed, and thanks for all the great work on Jexl!
--
This message was sent by Atlassian Jira
(v8.20.7#820007)