You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Hutton (Jira)" <ji...@apache.org> on 2022/05/25 08:28:00 UTC

[jira] [Commented] (JEXL-370) Cannot check if variable is defined using ObjectContext if the value is null

    [ https://issues.apache.org/jira/browse/JEXL-370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17541888#comment-17541888 ] 

Alex Hutton commented on JEXL-370:
----------------------------------

Many thanks for the confirmation and suggested workaround Henri.

> 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
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.3
>
>         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)