commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "madhav (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JEXL-52) Implicit evaluation of misspelled EL and ways to detect such occurrences
Date Tue, 23 Dec 2008 16:11:44 GMT

     [ https://issues.apache.org/jira/browse/JEXL-52?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

madhav updated JEXL-52:
-----------------------

    Description: 

I have a class called Athlete that has three boolean variables: ready, started and stopped.
I created an instance of it with the name "obj" and created a JexlContext using it. I also
registered a post JexlExprResolver with the Expression before calling evaluate() method on
it.

When I evaluate an incorrect EL "obj.statred" (method name is misspelled), evaluation calls
my JexlExprResolver's evaluate() method. However when I change the EL to "!obj.statred", evaluation
returns true.

There are two issues here.
1. Returning true for an expression that cant be evaluated
2. Not calling any post resolvers.

I'm using the above post resolver as a way of detecting misspelled ELs. 
But the support for such post resolver may go away in future versions. Can anybody suggest
a better way?


{code:title=Athlete.java|borderStyle=solid}
public class Athlete {

    private boolean ready;
    private boolean started;

    public Athlete(boolean ready) {
        this.ready = ready;
    }

    public boolean isStarted() {
        return started;
    }

    public void setStarted(boolean started) {
        this.started = started;
    }

    public boolean isReady() {
        return ready;
    }

    public void setReady(boolean ready) {
        this.ready = ready;
    }
}
{code}


  was:
I have a class called Athlete that has three boolean variables: ready, started and stopped.
I created an instance of it with the name "obj" and created a JexlContext using it. I also
registered a post JexlExprResolver with the Expression before calling evaluate() method on
it.

When I evaluate an incorrect EL "obj.statred" (method name is misspelled), evaluation calls
my JexlExprResolver's evaluate() method. However when I change the EL to "!obj.statred", evaluation
returns true.

There are two issues here.
1. Returning true for an expression that cant be evaluated
2. Not calling any post resolvers.

I'm using the above post resolver as a way of detecting misspelled ELs. But the support for
such post resolver may go away in future versions. Can anybody suggest a better way?


{code:title=Athlete.java|borderStyle=solid}
public class Athlete {

    private boolean ready;
    private boolean stopped = true;
    private boolean started;

    public Athlete(boolean ready) {
        this.ready = ready;
    }

    public boolean isStarted() {
        return started;
    }

    public void setStarted(boolean started) {
        this.started = started;
    }

    public boolean isStopped() {
        return stopped;
    }

    public void setStopped(boolean stopped) {
        this.stopped = stopped;
    }

    public boolean isReady() {
        return ready;
    }

    public void setReady(boolean ready) {
        this.ready = ready;
    }
}
{code}



> Implicit evaluation of misspelled EL and ways to detect such occurrences
> ------------------------------------------------------------------------
>
>                 Key: JEXL-52
>                 URL: https://issues.apache.org/jira/browse/JEXL-52
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 1.1.1
>         Environment: commons jexl 1.1.1
>            Reporter: madhav
>
> I have a class called Athlete that has three boolean variables: ready, started and stopped.
> I created an instance of it with the name "obj" and created a JexlContext using it. I
also registered a post JexlExprResolver with the Expression before calling evaluate() method
on it.
> When I evaluate an incorrect EL "obj.statred" (method name is misspelled), evaluation
calls my JexlExprResolver's evaluate() method. However when I change the EL to "!obj.statred",
evaluation returns true.
> There are two issues here.
> 1. Returning true for an expression that cant be evaluated
> 2. Not calling any post resolvers.
> I'm using the above post resolver as a way of detecting misspelled ELs. 
> But the support for such post resolver may go away in future versions. Can anybody suggest
a better way?
> {code:title=Athlete.java|borderStyle=solid}
> public class Athlete {
>     private boolean ready;
>     private boolean started;
>     public Athlete(boolean ready) {
>         this.ready = ready;
>     }
>     public boolean isStarted() {
>         return started;
>     }
>     public void setStarted(boolean started) {
>         this.started = started;
>     }
>     public boolean isReady() {
>         return ready;
>     }
>     public void setReady(boolean ready) {
>         this.ready = ready;
>     }
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message