commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Max Tardiveau (JIRA)" <>
Subject [jira] [Commented] (JEXL-113) Dot notation behaves unexpectedly with null values
Date Thu, 23 Jun 2011 12:06:50 GMT


Max Tardiveau commented on JEXL-113:

Hi Henri,

we love Jexl! It's not uncommon for this type of library to be widely used, but very much
under-recognized. Please know that we use it, and we like it.

After some more thinking about this, I can now see that handling null values is a challenge. 

Maybe we could have the option to turn off the dot operator? That would allow us to resolve
the dot operator in our context class, and perhaps come up with a way to handle nulls (e.g.
return zero instead of null). This can be done now with proxy classes, or by encapsulating
beans, but that seems like a lot of work.

In the meantime, we're going to turn on silent mode, and let nulls be treated as they are

Thanks for a valuable library!

-- Max

> Dot notation behaves unexpectedly with null values
> --------------------------------------------------
>                 Key: JEXL-113
>                 URL:
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 2.0.1
>         Environment: JDK 1.6
>            Reporter: Max Tardiveau
> When a variable of the form a.b is evaluated, the context is asked first for the value
of a. That value is then asked for the value of b.
> So far, so good: this is exactly what you'd expect from the dot operator.
> But if the value of b is null, the context is then asked for the value of a.b, in other
words the dot operator is ignored and "a.b" is considered to be a single variable.
> This is at best confusing. Granted, this can be avoided with the a['b'] notation, but
that's clumsy.
> I assume this is an attempt to support both the dot operator and ant-style variables.
I don't think you can have both and remain sane.
> Suggestion: either document this behavior, or make it an option. My vote would be to
just use the value returned, even if it's null. Either dot is an operator, or it's not. Perhaps
make that configurable?
> Thanks!

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message