commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Biestro (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JEXL-113) Dot notation behaves unexpectedly with null values
Date Tue, 21 Jun 2011 13:35:47 GMT

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

Henri Biestro commented on JEXL-113:
------------------------------------

Jexl since 1.0 has always been supporting ant-ish variable naming as well as the dot operator;
it was thus important to continue supporting this feature (especially since the jexl user
community is scattered and mostly silent :-( ). I doagree this behavior is anyway under-documented.

Note that variable resolution does not (should not) confuse the case if a conflict can occur;
ant-ish variables are only tried if no bean exists during the dotted-path resolution.

I'll try adding a 'no-antish vars' flag to the interpreter if this accommodates your needs
and allows regaining "sanity". If you were to attach a (junit) test case checking for the
desired behavior(s), it will definitely help speed up coming up with a proper solution.


> Dot notation behaves unexpectedly with null values
> --------------------------------------------------
>
>                 Key: JEXL-113
>                 URL: https://issues.apache.org/jira/browse/JEXL-113
>             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: http://www.atlassian.com/software/jira

        

Mime
View raw message